mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 10:21:04 +00:00
Added "Quick Reference" command.
- Added Launcher class to open files and URLs.
This commit is contained in:
parent
263c9d4e6e
commit
3d89a21e2f
@ -307,6 +307,8 @@
|
|||||||
<item command="options" text="&Options" />
|
<item command="options" text="&Options" />
|
||||||
</menu>
|
</menu>
|
||||||
<menu text="&Help">
|
<menu text="&Help">
|
||||||
|
<item command="quick_reference" text="Quick &Reference" />
|
||||||
|
<separator />
|
||||||
<item command="about" text="&About" />
|
<item command="about" text="&About" />
|
||||||
</menu>
|
</menu>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -11,6 +11,7 @@ COMMON_SOURCES = \
|
|||||||
src/console.cpp \
|
src/console.cpp \
|
||||||
src/context.cpp \
|
src/context.cpp \
|
||||||
src/gfxmode.cpp \
|
src/gfxmode.cpp \
|
||||||
|
src/launcher.cpp \
|
||||||
src/recent_files.cpp \
|
src/recent_files.cpp \
|
||||||
src/ui_context.cpp \
|
src/ui_context.cpp \
|
||||||
src/undoable.cpp \
|
src/undoable.cpp \
|
||||||
@ -59,6 +60,7 @@ COMMON_SOURCES = \
|
|||||||
src/commands/cmd_paste.cpp \
|
src/commands/cmd_paste.cpp \
|
||||||
src/commands/cmd_play_animation.cpp \
|
src/commands/cmd_play_animation.cpp \
|
||||||
src/commands/cmd_preview.cpp \
|
src/commands/cmd_preview.cpp \
|
||||||
|
src/commands/cmd_quick_reference.cpp \
|
||||||
src/commands/cmd_record_screen.cpp \
|
src/commands/cmd_record_screen.cpp \
|
||||||
src/commands/cmd_redo.cpp \
|
src/commands/cmd_redo.cpp \
|
||||||
src/commands/cmd_refresh.cpp \
|
src/commands/cmd_refresh.cpp \
|
||||||
|
57
src/commands/cmd_quick_reference.cpp
Normal file
57
src/commands/cmd_quick_reference.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/* ASE - Allegro Sprite Editor
|
||||||
|
* Copyright (C) 2001-2010 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"
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// about
|
||||||
|
|
||||||
|
class QuickReferenceCommand : public Command
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QuickReferenceCommand();
|
||||||
|
Command* clone() const { return new QuickReferenceCommand(*this); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void execute(Context* context);
|
||||||
|
};
|
||||||
|
|
||||||
|
QuickReferenceCommand::QuickReferenceCommand()
|
||||||
|
: Command("quick_reference",
|
||||||
|
"Quick Reference",
|
||||||
|
CmdUIOnlyFlag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickReferenceCommand::execute(Context* context)
|
||||||
|
{
|
||||||
|
std::string path = "docs/quickref.pdf";
|
||||||
|
|
||||||
|
Launcher::openFile(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// CommandFactory
|
||||||
|
|
||||||
|
Command* CommandFactory::create_quick_reference_command()
|
||||||
|
{
|
||||||
|
return new QuickReferenceCommand;
|
||||||
|
}
|
@ -75,6 +75,7 @@ FOR_EACH_COMMAND(play_animation)
|
|||||||
FOR_EACH_COMMAND(preview_fit_to_screen)
|
FOR_EACH_COMMAND(preview_fit_to_screen)
|
||||||
FOR_EACH_COMMAND(preview_normal)
|
FOR_EACH_COMMAND(preview_normal)
|
||||||
FOR_EACH_COMMAND(preview_tiled)
|
FOR_EACH_COMMAND(preview_tiled)
|
||||||
|
FOR_EACH_COMMAND(quick_reference)
|
||||||
FOR_EACH_COMMAND(record_screen)
|
FOR_EACH_COMMAND(record_screen)
|
||||||
FOR_EACH_COMMAND(redo)
|
FOR_EACH_COMMAND(redo)
|
||||||
FOR_EACH_COMMAND(refresh)
|
FOR_EACH_COMMAND(refresh)
|
||||||
|
43
src/launcher.cpp
Normal file
43
src/launcher.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* ASE - Allegro Sprite Editor
|
||||||
|
* Copyright (C) 2001-2010 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 "launcher.h"
|
||||||
|
|
||||||
|
void Launcher::openUrl(const std::string& url)
|
||||||
|
{
|
||||||
|
openFile(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Launcher::openFile(const std::string& file)
|
||||||
|
{
|
||||||
|
#if defined ALLEGRO_WINDOWS
|
||||||
|
|
||||||
|
system(("start " + file).c_str());
|
||||||
|
|
||||||
|
#elif defined ALLEGRO_MACOSX
|
||||||
|
|
||||||
|
system(("open " + file).c_str());
|
||||||
|
|
||||||
|
#else // Linux
|
||||||
|
|
||||||
|
system(("todo " + file).c_str());
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
32
src/launcher.h
Normal file
32
src/launcher.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* ASE - Allegro Sprite Editor
|
||||||
|
* Copyright (C) 2001-2010 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LAUNCHER_H_INCLUDED
|
||||||
|
#define LAUNCHER_H_INCLUDED
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class Launcher
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void openUrl(const std::string& url);
|
||||||
|
static void openFile(const std::string& file);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user