Replace "QuickReference" and "Donate" commands with "Launch".

This commit is contained in:
David Capello 2011-07-27 22:48:28 -03:00
parent c35c258bd5
commit dd65f0cf7f
6 changed files with 119 additions and 132 deletions

View File

@ -322,9 +322,23 @@
<item command="ScreenShot" text="&amp;Screen Shot" />
</menu>
<menu text="&amp;Help">
<item command="QuickReference" text="Quick &amp;Reference" />
<item command="Launch" text="Quick &amp;Reference">
<param name="type" value="docs" />
<param name="path" value="quickref.pdf" />
</item>
<item command="Launch" text="Wiki">
<param name="type" value="url" />
<param name="path" value="http://code.google.com/p/aseprite/wiki/Home" />
</item>
<separator />
<item command="Donate" text="&amp;Donate" />
<item command="Launch" text="Release Notes">
<param name="type" value="url" />
<param name="path" value="http://code.google.com/p/aseprite/wiki/ReleaseNotes" />
</item>
<item command="Launch" text="&amp;Donate">
<param name="type" value="url" />
<param name="path" value="http://www.aseprite.org/donate/" />
</item>
<separator />
<item command="About" text="&amp;About" />
</menu>

View File

@ -135,7 +135,6 @@ add_library(aseprite-library
commands/cmd_cut.cpp
commands/cmd_deselect_mask.cpp
commands/cmd_developer_console.cpp
commands/cmd_donate.cpp
commands/cmd_duplicate_layer.cpp
commands/cmd_duplicate_sprite.cpp
commands/cmd_exit.cpp
@ -148,6 +147,7 @@ add_library(aseprite-library
commands/cmd_goto_layer.cpp
commands/cmd_grid.cpp
commands/cmd_invert_mask.cpp
commands/cmd_launch.cpp
commands/cmd_layer_from_background.cpp
commands/cmd_layer_properties.cpp
commands/cmd_load_mask.cpp
@ -167,7 +167,6 @@ add_library(aseprite-library
commands/cmd_paste.cpp
commands/cmd_play_animation.cpp
commands/cmd_preview.cpp
commands/cmd_quick_reference.cpp
commands/cmd_redo.cpp
commands/cmd_refresh.cpp
commands/cmd_remove_cel.cpp

View File

@ -1,59 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2011 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "commands/command.h"
#include "launcher.h"
//////////////////////////////////////////////////////////////////////
// donate
class DonateCommand : public Command
{
public:
DonateCommand();
Command* clone() const { return new DonateCommand(*this); }
protected:
void onExecute(Context* context);
};
DonateCommand::DonateCommand()
: Command("Donate",
"Donate",
CmdUIOnlyFlag)
{
}
void DonateCommand::onExecute(Context* context)
{
std::string url;
url += WEBSITE;
url += "donate/";
Launcher::openUrl(url);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createDonateCommand()
{
return new DonateCommand;
}

101
src/commands/cmd_launch.cpp Normal file
View File

@ -0,0 +1,101 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2011 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "base/compiler_specific.h"
#include "commands/command.h"
#include "commands/params.h"
#include "launcher.h"
#include "resource_finder.h"
#include <allegro.h>
//////////////////////////////////////////////////////////////////////
// launch
class LaunchCommand : public Command
{
public:
LaunchCommand();
Command* clone() const { return new LaunchCommand(*this); }
protected:
void onLoadParams(Params* params) OVERRIDE;
void onExecute(Context* context) OVERRIDE;
private:
enum Type { Url, FileInDocs };
Type m_type;
std::string m_path;
};
LaunchCommand::LaunchCommand()
: Command("Launch",
"Launch",
CmdUIOnlyFlag)
, m_type(Url)
, m_path("")
{
}
void LaunchCommand::onLoadParams(Params* params)
{
std::string type = params->get("type");
if (type == "docs")
m_type = FileInDocs;
else if (type == "url")
m_type = Url;
m_path = params->get("path");
}
void LaunchCommand::onExecute(Context* context)
{
switch (m_type) {
case Url:
Launcher::openUrl(m_path);
break;
case FileInDocs:
{
ResourceFinder rf;
rf.findInDocsDir(m_path.c_str());
while (const char* path = rf.next()) {
if (!exists(path))
continue;
Launcher::openFile(path);
break;
}
}
break;
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createLaunchCommand()
{
return new LaunchCommand;
}

View File

@ -1,67 +0,0 @@
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2011 David Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <allegro.h>
#include "commands/command.h"
#include "launcher.h"
#include "resource_finder.h"
//////////////////////////////////////////////////////////////////////
// about
class QuickReferenceCommand : public Command
{
public:
QuickReferenceCommand();
Command* clone() const { return new QuickReferenceCommand(*this); }
protected:
void onExecute(Context* context);
};
QuickReferenceCommand::QuickReferenceCommand()
: Command("QuickReference",
"Quick Reference",
CmdUIOnlyFlag)
{
}
void QuickReferenceCommand::onExecute(Context* context)
{
ResourceFinder rf;
rf.findInDocsDir("quickref.pdf");
while (const char* path = rf.next()) {
if (!exists(path))
continue;
Launcher::openFile(path);
break;
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createQuickReferenceCommand()
{
return new QuickReferenceCommand;
}

View File

@ -39,7 +39,6 @@ FOR_EACH_COMMAND(Cut)
FOR_EACH_COMMAND(DeselectMask)
FOR_EACH_COMMAND(Despeckle)
FOR_EACH_COMMAND(DeveloperConsole)
FOR_EACH_COMMAND(Donate)
FOR_EACH_COMMAND(DuplicateLayer)
FOR_EACH_COMMAND(DuplicateSprite)
FOR_EACH_COMMAND(Exit)
@ -57,6 +56,7 @@ FOR_EACH_COMMAND(GotoPreviousLayer)
FOR_EACH_COMMAND(GridSettings)
FOR_EACH_COMMAND(InvertColor)
FOR_EACH_COMMAND(InvertMask)
FOR_EACH_COMMAND(Launch)
FOR_EACH_COMMAND(LayerFromBackground)
FOR_EACH_COMMAND(LayerProperties)
FOR_EACH_COMMAND(LoadMask)
@ -77,7 +77,6 @@ FOR_EACH_COMMAND(PaletteEditor)
FOR_EACH_COMMAND(Paste)
FOR_EACH_COMMAND(PlayAnimation)
FOR_EACH_COMMAND(Preview)
FOR_EACH_COMMAND(QuickReference)
FOR_EACH_COMMAND(Redo)
FOR_EACH_COMMAND(Refresh)
FOR_EACH_COMMAND(RemoveCel)