Refactor: Move app files to src/app subdirectory inside app namespace

- Add HAVE_CONFIG_H wrapper to #include "config.h"
- Removed widgets namespace (it's in app now)
- Move some functions from src/file/file.h to src/base/cfile.h
- Move Vector2d to base library
- Rename MenuItem2 to AppMenuItem
This commit is contained in:
David Capello 2013-08-05 21:20:19 -03:00
parent 5bd57061c6
commit c88f9b172b
711 changed files with 16806 additions and 14715 deletions

View File

@ -2,7 +2,8 @@
* Warning icon when selecting RGB/HSB color in indexed image.
* Warning message when we open a file that is already opened file
(show an option to create a second view).
(show an option to create a second view, or maybe this should
be forbidden).
* Paste in place doesn't work as expected sometimes (copy something
from one frame, paste in other frame).
* After moving a frame, all thumbnails are shown incorrectly.
@ -20,15 +21,15 @@
* Fix problem with export sprite sheet when the cel has negative pos
* Add a warning when exporting RGB sprite to GIF, hinting at the quantize function.
* MovingPixelsState: Add undo information in each transformation step.
* Add IntEntry class in src/gui/ with spin-buttons.
* Add IntEntry class in src/ui/ with spin-buttons.
* Add feedback to "Shift+S" shortcut to switch "snap to grid".
* Add color swatches bar.
* Sort palette entries.
* Add "Remap" button to palette editor after a palette entry is modified:
This button should apply a color curve to the whole sprite to remap
old indexes to the new positions.
* Move launcher.cpp to base/ lib adding an extension point for "gui" lib.
* Move src/dialogs/aniedit,filesel to src/widgets (remove dialogs/ directory).
* Move src/app/dialogs/aniedit,filesel to src/app/ui
(remove app/dialogs/ directory).
* Merge everything related to configuration/settings in one class
(allow configuration per document). Use cfg.cpp and settings/ dir.
* Refactor src/file/ in several layers.

View File

@ -39,7 +39,7 @@
#define PRINTF verbose_printf
// Defined in src/log.cpp
// verbose_printf is defined in src/app/log.cpp and used through PRINTF macro
void verbose_printf(const char* format, ...);
#include <math.h>

View File

@ -25,9 +25,9 @@ mv tmp ../config.h
sed -e "s/gui version=\".*/gui version=\"$version\">/" < ../data/gui.xml > tmp
mv tmp ../data/gui.xml
sed -e "s/FILEVERSION .*/FILEVERSION $version_win32/" < ../src/resources_win32.rc \
sed -e "s/FILEVERSION .*/FILEVERSION $version_win32/" < ../src/main/resources_win32.rc \
| sed -e "s/PRODUCTVERSION .*/PRODUCTVERSION $version_win32/" \
| sed -e "s/FileVersion\",.*/FileVersion\", \"$version_win32\"/" \
| sed -e "s/ProductVersion\",.*/ProductVersion\", \"$version_win32\"/" \
> tmp
mv tmp ../src/resources_win32.rc
mv tmp ../src/main/resources_win32.rc

View File

@ -11,9 +11,9 @@ if(MSVC)
endif(MSVC)
# Libraries in this directory
set(aseprite_libraries aseprite-library scripting-lib
undo-lib filters-lib ui-lib
she gfx-lib base-lib)
set(aseprite_libraries app-library raster-lib
scripting-lib undo-lib filters-lib ui-lib
she gfx-lib base-lib)
# Directories where .h files can be found
include_directories(. .. ../third_party)
@ -147,9 +147,11 @@ endif()
######################################################################
# ASEPRITE libraries
add_subdirectory(app)
add_subdirectory(base)
add_subdirectory(filters)
add_subdirectory(gfx)
add_subdirectory(raster)
add_subdirectory(scripting)
add_subdirectory(she)
add_subdirectory(ui)
@ -166,276 +168,18 @@ if(LIBALLEGRO4_LINK_FLAGS)
set(all_libs ${all_libs} ${LIBALLEGRO4_LINK_FLAGS})
endif()
add_library(aseprite-library
app.cpp
app_menus.cpp
console.cpp
context.cpp
context_flags.cpp
context_observer_list.cpp
document.cpp
document_api.cpp
document_location.cpp
document_undo.cpp
documents.cpp
drop_files.cpp
file_system.cpp
flatten.cpp
gfxmode.cpp
gui_xml.cpp
ini_file.cpp
job.cpp
launcher.cpp
log.cpp
modules.cpp
objects_container_impl.cpp
recent_files.cpp
resource_finder.cpp
shell.cpp
thumbnail_generator.cpp
ui_context.cpp
undo_transaction.cpp
xml_exception.cpp
app/app_options.cpp
app/backup.cpp
app/check_update.cpp
app/color.cpp
app/color_swatches.cpp
app/color_utils.cpp
app/data_recovery.cpp
app/file_selector.cpp
app/project.cpp
app/webserver.cpp
app/widget_loader.cpp
commands/cmd_about.cpp
commands/cmd_advanced_mode.cpp
commands/cmd_background_from_layer.cpp
commands/cmd_cancel.cpp
commands/cmd_canvas_size.cpp
commands/cmd_cel_properties.cpp
commands/cmd_change_color.cpp
commands/cmd_change_image_type.cpp
commands/cmd_change_pen.cpp
commands/cmd_clear.cpp
commands/cmd_close_file.cpp
commands/cmd_configure_tools.cpp
commands/cmd_copy.cpp
commands/cmd_copy_cel.cpp
commands/cmd_crop.cpp
commands/cmd_cut.cpp
commands/cmd_deselect_mask.cpp
commands/cmd_developer_console.cpp
commands/cmd_duplicate_layer.cpp
commands/cmd_duplicate_sprite.cpp
commands/cmd_exit.cpp
commands/cmd_export_sprite_sheet.cpp
commands/cmd_eyedropper.cpp
commands/cmd_film_editor.cpp
commands/cmd_flatten_layers.cpp
commands/cmd_flip.cpp
commands/cmd_frame_properties.cpp
commands/cmd_goto_frame.cpp
commands/cmd_goto_layer.cpp
commands/cmd_goto_tab.cpp
commands/cmd_grid.cpp
commands/cmd_import_sprite_sheet.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
commands/cmd_mask_all.cpp
commands/cmd_mask_by_color.cpp
commands/cmd_merge_down_layer.cpp
commands/cmd_move_cel.cpp
commands/cmd_new_file.cpp
commands/cmd_new_frame.cpp
commands/cmd_new_layer.cpp
commands/cmd_new_layer_set.cpp
commands/cmd_open_file.cpp
commands/cmd_open_in_folder.cpp
commands/cmd_open_with_app.cpp
commands/cmd_options.cpp
commands/cmd_palette_editor.cpp
commands/cmd_paste.cpp
commands/cmd_play_animation.cpp
commands/cmd_preview.cpp
commands/cmd_refresh.cpp
commands/cmd_remove_cel.cpp
commands/cmd_remove_frame.cpp
commands/cmd_remove_layer.cpp
commands/cmd_reselect_mask.cpp
commands/cmd_rotate_canvas.cpp
commands/cmd_save_file.cpp
commands/cmd_save_mask.cpp
commands/cmd_scroll.cpp
commands/cmd_sprite_editor.cpp
commands/cmd_sprite_properties.cpp
commands/cmd_sprite_size.cpp
commands/cmd_switch_colors.cpp
commands/cmd_undo.cpp
commands/command.cpp
commands/commands.cpp
commands/filters/cmd_color_curve.cpp
commands/filters/cmd_convolution_matrix.cpp
commands/filters/cmd_despeckle.cpp
commands/filters/cmd_invert_color.cpp
commands/filters/cmd_replace_color.cpp
commands/filters/color_curve_editor.cpp
commands/filters/convolution_matrix_stock.cpp
commands/filters/filter_manager_impl.cpp
commands/filters/filter_preview.cpp
commands/filters/filter_target_buttons.cpp
commands/filters/filter_window.cpp
commands/filters/filter_worker.cpp
dialogs/aniedit.cpp
dialogs/maskcol.cpp
file/ase_format.cpp
file/bmp_format.cpp
file/file.cpp
file/file_format.cpp
file/file_formats_manager.cpp
file/fli/fli.cpp
file/fli_format.cpp
file/gif_format.cpp
file/ico_format.cpp
file/jpeg_format.cpp
file/pcx_format.cpp
file/png_format.cpp
file/tga_format.cpp
modules/editors.cpp
modules/gfx.cpp
modules/gui.cpp
modules/palettes.cpp
raster/algo.cpp
raster/algo_polygon.cpp
raster/algofill.cpp
raster/algorithm/flip_image.cpp
raster/blend.cpp
raster/cel.cpp
raster/cel_io.cpp
raster/dirty.cpp
raster/dirty_io.cpp
raster/gfxobj.cpp
raster/image.cpp
raster/image_io.cpp
raster/images_collector.cpp
raster/layer.cpp
raster/layer_io.cpp
raster/mask.cpp
raster/mask_io.cpp
raster/palette.cpp
raster/palette_io.cpp
raster/pen.cpp
raster/quantization.cpp
raster/rgbmap.cpp
raster/rotate.cpp
raster/sprite.cpp
raster/stock.cpp
settings/ui_settings_impl.cpp
skin/button_icon_impl.cpp
skin/skin_theme.cpp
skin/skin_property.cpp
skin/skin_slider_property.cpp
tools/intertwine.cpp
tools/point_shape.cpp
tools/shade_table.cpp
tools/tool_box.cpp
tools/tool_loop_manager.cpp
undoers/add_cel.cpp
undoers/add_frame.cpp
undoers/add_image.cpp
undoers/add_layer.cpp
undoers/add_palette.cpp
undoers/close_group.cpp
undoers/dirty_area.cpp
undoers/flip_image.cpp
undoers/image_area.cpp
undoers/move_layer.cpp
undoers/open_group.cpp
undoers/remap_palette.cpp
undoers/remove_cel.cpp
undoers/remove_frame.cpp
undoers/remove_image.cpp
undoers/remove_layer.cpp
undoers/remove_palette.cpp
undoers/replace_image.cpp
undoers/set_cel_frame.cpp
undoers/set_cel_opacity.cpp
undoers/set_cel_position.cpp
undoers/set_frame_duration.cpp
undoers/set_layer_flags.cpp
undoers/set_layer_name.cpp
undoers/set_mask.cpp
undoers/set_mask_position.cpp
undoers/set_palette_colors.cpp
undoers/set_sprite_pixel_format.cpp
undoers/set_sprite_size.cpp
undoers/set_stock_pixel_format.cpp
undoers/set_total_frames.cpp
util/autocrop.cpp
util/boundary.cpp
util/celmove.cpp
util/clipboard.cpp
util/col_file.cpp
util/expand_cel_canvas.cpp
util/filetoks.cpp
util/gpl_file.cpp
util/misc.cpp
util/msk_file.cpp
util/pic_file.cpp
util/render.cpp
util/thmbnail.cpp
widgets/button_set.cpp
widgets/color_bar.cpp
widgets/color_button.cpp
widgets/color_selector.cpp
widgets/color_sliders.cpp
widgets/context_bar.cpp
widgets/document_view.cpp
widgets/drop_down_button.cpp
widgets/editor/cursor.cpp
widgets/editor/drawing_state.cpp
widgets/editor/editor.cpp
widgets/editor/editor_observers.cpp
widgets/editor/editor_states_history.cpp
widgets/editor/editor_view.cpp
widgets/editor/keys.cpp
widgets/editor/moving_cel_state.cpp
widgets/editor/moving_pixels_state.cpp
widgets/editor/pixels_movement.cpp
widgets/editor/scrolling_state.cpp
widgets/editor/select_box_state.cpp
widgets/editor/standby_state.cpp
widgets/editor/tool_loop_impl.cpp
widgets/editor/transform_handles.cpp
widgets/file_list.cpp
widgets/file_selector.cpp
widgets/hex_color_entry.cpp
widgets/main_menu_bar.cpp
widgets/main_window.cpp
widgets/menuitem2.cpp
widgets/mini_editor.cpp
widgets/palette_view.cpp
widgets/popup_window_pin.cpp
widgets/status_bar.cpp
widgets/tabs.cpp
widgets/toolbar.cpp
widgets/workspace.cpp
widgets/workspace_part.cpp)
######################################################################
# ASEPRITE application
if(WIN32)
set(win32_resources resources_win32.rc)
set(win32_resources main/resources_win32.rc)
endif(WIN32)
if(UNIX)
set(x11_resources xpm_icon.c)
set(x11_resources main/xpm_icon.c)
endif(UNIX)
add_executable(aseprite WIN32 main.cpp ${win32_resources} ${x11_resources})
add_executable(aseprite WIN32 main/main.cpp ${win32_resources} ${x11_resources})
target_link_libraries(aseprite ${all_libs})
install(TARGETS aseprite

View File

@ -1,94 +0,0 @@
/* ASEPRITE
* Copyright (C) 2001-2013 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 APP_H_INCLUDED
#define APP_H_INCLUDED
#include "base/signal.h"
#include "base/string.h"
#include "base/system_console.h"
#include "base/unique_ptr.h"
#include "raster/pixel_format.h"
#include <vector>
class Document;
class Layer;
class LegacyModules;
class LoggerModule;
class MainWindow;
class RecentFiles;
namespace ui {
class MenuBar;
class Widget;
class Window;
}
namespace tools { class ToolBox; }
class App
{
public:
App(int argc, const char* argv[]);
~App();
static App* instance() { return m_instance; }
// Returns true if ASEPRITE is running with GUI available.
bool isGui() const { return m_isGui; }
// Runs the ASEPRITE application. In GUI mode it's the top-level
// window, in console/scripting it just runs the specified scripts.
int run();
tools::ToolBox* getToolBox() const;
RecentFiles* getRecentFiles() const;
MainWindow* getMainWindow() const { return m_mainWindow; }
// App Signals
Signal0<void> Exit;
Signal0<void> PaletteChange;
Signal0<void> PenSizeBeforeChange;
Signal0<void> PenSizeAfterChange;
Signal0<void> PenAngleBeforeChange;
Signal0<void> PenAngleAfterChange;
Signal0<void> CurrentToolChange;
private:
typedef std::vector<base::string> FileList;
class Modules;
static App* m_instance;
base::SystemConsole m_systemConsole;
Modules* m_modules;
LegacyModules* m_legacy;
bool m_isGui;
bool m_isShell;
UniquePtr<MainWindow> m_mainWindow;
FileList m_files;
};
void app_refresh_screen();
void app_rebuild_documents_tabs();
PixelFormat app_get_current_pixel_format();
void app_default_statusbar_message();
int app_get_color_to_clear_layer(Layer* layer);
#endif

233
src/app/CMakeLists.txt Normal file
View File

@ -0,0 +1,233 @@
# Aseprite
# Copyright (C) 2001-2013 David Capello
add_library(app-library
app.cpp
app_menus.cpp
app_options.cpp
backup.cpp
check_update.cpp
color.cpp
color_swatches.cpp
color_utils.cpp
commands/cmd_about.cpp
commands/cmd_advanced_mode.cpp
commands/cmd_background_from_layer.cpp
commands/cmd_cancel.cpp
commands/cmd_canvas_size.cpp
commands/cmd_cel_properties.cpp
commands/cmd_change_color.cpp
commands/cmd_change_image_type.cpp
commands/cmd_change_pen.cpp
commands/cmd_clear.cpp
commands/cmd_close_file.cpp
commands/cmd_configure_tools.cpp
commands/cmd_copy.cpp
commands/cmd_copy_cel.cpp
commands/cmd_crop.cpp
commands/cmd_cut.cpp
commands/cmd_deselect_mask.cpp
commands/cmd_developer_console.cpp
commands/cmd_duplicate_layer.cpp
commands/cmd_duplicate_sprite.cpp
commands/cmd_exit.cpp
commands/cmd_export_sprite_sheet.cpp
commands/cmd_eyedropper.cpp
commands/cmd_film_editor.cpp
commands/cmd_flatten_layers.cpp
commands/cmd_flip.cpp
commands/cmd_frame_properties.cpp
commands/cmd_goto_frame.cpp
commands/cmd_goto_layer.cpp
commands/cmd_goto_tab.cpp
commands/cmd_grid.cpp
commands/cmd_import_sprite_sheet.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
commands/cmd_mask_all.cpp
commands/cmd_mask_by_color.cpp
commands/cmd_merge_down_layer.cpp
commands/cmd_move_cel.cpp
commands/cmd_new_file.cpp
commands/cmd_new_frame.cpp
commands/cmd_new_layer.cpp
commands/cmd_new_layer_set.cpp
commands/cmd_open_file.cpp
commands/cmd_open_in_folder.cpp
commands/cmd_open_with_app.cpp
commands/cmd_options.cpp
commands/cmd_palette_editor.cpp
commands/cmd_paste.cpp
commands/cmd_play_animation.cpp
commands/cmd_preview.cpp
commands/cmd_refresh.cpp
commands/cmd_remove_cel.cpp
commands/cmd_remove_frame.cpp
commands/cmd_remove_layer.cpp
commands/cmd_reselect_mask.cpp
commands/cmd_rotate_canvas.cpp
commands/cmd_save_file.cpp
commands/cmd_save_mask.cpp
commands/cmd_scroll.cpp
commands/cmd_sprite_editor.cpp
commands/cmd_sprite_properties.cpp
commands/cmd_sprite_size.cpp
commands/cmd_switch_colors.cpp
commands/cmd_undo.cpp
commands/command.cpp
commands/commands.cpp
commands/filters/cmd_color_curve.cpp
commands/filters/cmd_convolution_matrix.cpp
commands/filters/cmd_despeckle.cpp
commands/filters/cmd_invert_color.cpp
commands/filters/cmd_replace_color.cpp
commands/filters/color_curve_editor.cpp
commands/filters/convolution_matrix_stock.cpp
commands/filters/filter_manager_impl.cpp
commands/filters/filter_preview.cpp
commands/filters/filter_target_buttons.cpp
commands/filters/filter_window.cpp
commands/filters/filter_worker.cpp
console.cpp
context.cpp
context_flags.cpp
context_observer_list.cpp
data_recovery.cpp
dialogs/aniedit.cpp
dialogs/maskcol.cpp
document.cpp
document_api.cpp
document_location.cpp
document_undo.cpp
documents.cpp
drop_files.cpp
file/ase_format.cpp
file/bmp_format.cpp
file/file.cpp
file/file_format.cpp
file/file_formats_manager.cpp
file/fli/fli.cpp
file/fli_format.cpp
file/gif_format.cpp
file/ico_format.cpp
file/jpeg_format.cpp
file/pcx_format.cpp
file/png_format.cpp
file/tga_format.cpp
file_selector.cpp
file_system.cpp
flatten.cpp
gfxmode.cpp
gui_xml.cpp
ini_file.cpp
job.cpp
launcher.cpp
log.cpp
modules.cpp
modules/editors.cpp
modules/gfx.cpp
modules/gui.cpp
modules/palettes.cpp
objects_container_impl.cpp
project.cpp
recent_files.cpp
resource_finder.cpp
settings/ui_settings_impl.cpp
shell.cpp
thumbnail_generator.cpp
tools/intertwine.cpp
tools/point_shape.cpp
tools/shade_table.cpp
tools/tool_box.cpp
tools/tool_loop_manager.cpp
ui/app_menuitem.cpp
ui/button_set.cpp
ui/color_bar.cpp
ui/color_button.cpp
ui/color_selector.cpp
ui/color_sliders.cpp
ui/context_bar.cpp
ui/document_view.cpp
ui/drop_down_button.cpp
ui/editor/cursor.cpp
ui/editor/drawing_state.cpp
ui/editor/editor.cpp
ui/editor/editor_observers.cpp
ui/editor/editor_states_history.cpp
ui/editor/editor_view.cpp
ui/editor/keys.cpp
ui/editor/moving_cel_state.cpp
ui/editor/moving_pixels_state.cpp
ui/editor/pixels_movement.cpp
ui/editor/scrolling_state.cpp
ui/editor/select_box_state.cpp
ui/editor/standby_state.cpp
ui/editor/tool_loop_impl.cpp
ui/editor/transform_handles.cpp
ui/file_list.cpp
ui/file_selector.cpp
ui/hex_color_entry.cpp
ui/main_menu_bar.cpp
ui/main_window.cpp
ui/mini_editor.cpp
ui/palette_view.cpp
ui/popup_window_pin.cpp
ui/skin/button_icon_impl.cpp
ui/skin/skin_property.cpp
ui/skin/skin_slider_property.cpp
ui/skin/skin_theme.cpp
ui/status_bar.cpp
ui/tabs.cpp
ui/toolbar.cpp
ui/workspace.cpp
ui/workspace_part.cpp
ui_context.cpp
undo_transaction.cpp
undoers/add_cel.cpp
undoers/add_frame.cpp
undoers/add_image.cpp
undoers/add_layer.cpp
undoers/add_palette.cpp
undoers/close_group.cpp
undoers/dirty_area.cpp
undoers/flip_image.cpp
undoers/image_area.cpp
undoers/move_layer.cpp
undoers/open_group.cpp
undoers/remap_palette.cpp
undoers/remove_cel.cpp
undoers/remove_frame.cpp
undoers/remove_image.cpp
undoers/remove_layer.cpp
undoers/remove_palette.cpp
undoers/replace_image.cpp
undoers/set_cel_frame.cpp
undoers/set_cel_opacity.cpp
undoers/set_cel_position.cpp
undoers/set_frame_duration.cpp
undoers/set_layer_flags.cpp
undoers/set_layer_name.cpp
undoers/set_mask.cpp
undoers/set_mask_position.cpp
undoers/set_palette_colors.cpp
undoers/set_sprite_pixel_format.cpp
undoers/set_sprite_size.cpp
undoers/set_stock_pixel_format.cpp
undoers/set_total_frames.cpp
util/autocrop.cpp
util/boundary.cpp
util/celmove.cpp
util/clipboard.cpp
util/expand_cel_canvas.cpp
util/filetoks.cpp
util/misc.cpp
util/msk_file.cpp
util/pic_file.cpp
util/render.cpp
util/thmbnail.cpp
webserver.cpp
widget_loader.cpp
xml_exception.cpp)

View File

@ -16,58 +16,59 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/app_options.h"
#include "app/check_update.h"
#include "app/color_utils.h"
#include "app/commands/commands.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/data_recovery.h"
#include "app/document_location.h"
#include "app/document_observer.h"
#include "app/drop_files.h"
#include "app/file/file.h"
#include "app/file/file_formats_manager.h"
#include "app/file_system.h"
#include "app/find_widget.h"
#include "app/gui_xml.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "app/log.h"
#include "app/modules.h"
#include "app/modules/gfx.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/recent_files.h"
#include "app/shell.h"
#include "app/tools/tool_box.h"
#include "app/ui/color_bar.h"
#include "app/ui/editor/editor.h"
#include "app/ui/editor/editor_view.h"
#include "app/ui/main_window.h"
#include "app/ui/status_bar.h"
#include "app/ui/tabs.h"
#include "app/ui/toolbar.h"
#include "app/ui_context.h"
#include "app/util/boundary.h"
#include "app/util/render.h"
#include "app/webserver.h"
#include "base/exception.h"
#include "base/unique_ptr.h"
#include "commands/commands.h"
#include "commands/params.h"
#include "console.h"
#include "document_location.h"
#include "document_observer.h"
#include "drop_files.h"
#include "file/file.h"
#include "file/file_formats_manager.h"
#include "file_system.h"
#include "gui_xml.h"
#include "ini_file.h"
#include "log.h"
#include "modules.h"
#include "modules/gfx.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "recent_files.h"
#include "scripting/engine.h"
#include "shell.h"
#include "tools/tool_box.h"
#include "ui/gui.h"
#include "ui/intern.h"
#include "ui_context.h"
#include "util/boundary.h"
#include "util/render.h"
#include "widgets/color_bar.h"
#include "widgets/editor/editor.h"
#include "widgets/editor/editor_view.h"
#include "widgets/main_window.h"
#include "widgets/status_bar.h"
#include "widgets/tabs.h"
#include "widgets/toolbar.h"
#include "ui/ui.h"
#include <allegro.h>
/* #include <allegro/internal/aintern.h> */
#include <iostream>
#include <memory>
#include <stdarg.h>
@ -80,10 +81,11 @@
#include <winalleg.h>
#endif
namespace app {
using namespace ui;
class App::Modules
{
class App::Modules {
public:
ConfigModule m_configModule;
LoggerModule m_loggerModule;
@ -114,7 +116,7 @@ App::App(int argc, const char* argv[])
ASSERT(m_instance == NULL);
m_instance = this;
app::AppOptions options(argc, argv);
AppOptions options(argc, argv);
m_modules = new Modules(!options.startUI(), options.verbose());
m_isGui = options.startUI();
@ -136,7 +138,7 @@ App::App(int argc, const char* argv[])
const char* palFile = options.paletteFileName().c_str();
PRINTF("Loading custom palette file: %s\n", palFile);
UniquePtr<Palette> pal(Palette::load(palFile));
base::UniquePtr<Palette> pal(Palette::load(palFile));
if (pal.get() == NULL)
throw base::Exception("Error loading default palette from: %s", palFile);
@ -346,3 +348,5 @@ int app_get_color_to_clear_layer(Layer* layer)
return color_utils::color_for_layer(color, layer);
}
} // namespace app

103
src/app/app.h Normal file
View File

@ -0,0 +1,103 @@
/* ASEPRITE
* Copyright (C) 2001-2013 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 APP_APP_H_INCLUDED
#define APP_APP_H_INCLUDED
#include "base/signal.h"
#include "base/string.h"
#include "base/system_console.h"
#include "base/unique_ptr.h"
#include "raster/pixel_format.h"
#include <vector>
namespace ui {
class MenuBar;
class Widget;
class Window;
}
namespace raster {
class Layer;
}
namespace app {
class Document;
class LegacyModules;
class LoggerModule;
class MainWindow;
class RecentFiles;
namespace tools {
class ToolBox;
}
using namespace raster;
class App {
public:
App(int argc, const char* argv[]);
~App();
static App* instance() { return m_instance; }
// Returns true if ASEPRITE is running with GUI available.
bool isGui() const { return m_isGui; }
// Runs the ASEPRITE application. In GUI mode it's the top-level
// window, in console/scripting it just runs the specified scripts.
int run();
tools::ToolBox* getToolBox() const;
RecentFiles* getRecentFiles() const;
MainWindow* getMainWindow() const { return m_mainWindow; }
// App Signals
Signal0<void> Exit;
Signal0<void> PaletteChange;
Signal0<void> PenSizeBeforeChange;
Signal0<void> PenSizeAfterChange;
Signal0<void> PenAngleBeforeChange;
Signal0<void> PenAngleAfterChange;
Signal0<void> CurrentToolChange;
private:
typedef std::vector<base::string> FileList;
class Modules;
static App* m_instance;
base::SystemConsole m_systemConsole;
Modules* m_modules;
LegacyModules* m_legacy;
bool m_isGui;
bool m_isShell;
base::UniquePtr<MainWindow> m_mainWindow;
FileList m_files;
};
void app_refresh_screen();
void app_rebuild_documents_tabs();
PixelFormat app_get_current_pixel_format();
void app_default_statusbar_message();
int app_get_color_to_clear_layer(Layer* layer);
} // namespace app
#endif

View File

@ -16,24 +16,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app_menus.h"
#include "app/app_menus.h"
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/gui_xml.h"
#include "app/modules/gui.h"
#include "app/recent_files.h"
#include "app/tools/tool_box.h"
#include "app/ui/app_menuitem.h"
#include "app/ui/main_window.h"
#include "app/util/filetoks.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "commands/params.h"
#include "console.h"
#include "gui_xml.h"
#include "modules/gui.h"
#include "recent_files.h"
#include "tools/tool_box.h"
#include "ui/gui.h"
#include "util/filetoks.h"
#include "widgets/main_window.h"
#include "widgets/menuitem2.h"
#include "ui/ui.h"
#include "tinyxml.h"
#include <allegro/file.h>
@ -41,6 +43,8 @@
#include <stdio.h>
#include <string.h>
namespace app {
using namespace ui;
static void destroy_instance(AppMenus* instance)
@ -238,12 +242,12 @@ bool AppMenus::rebuildRecentList()
params.set("filename", filename);
menuitem = new MenuItem2(get_filename(filename), cmd_open_file, &params);
menuitem = new AppMenuItem(get_filename(filename), cmd_open_file, &params);
submenu->addChild(menuitem);
}
}
else {
menuitem = new MenuItem2("Nothing", NULL, NULL);
menuitem = new AppMenuItem("Nothing", NULL, NULL);
menuitem->setEnabled(false);
submenu->addChild(menuitem);
}
@ -322,9 +326,9 @@ Widget* AppMenus::convertXmlelemToMenuitem(TiXmlElement* elem)
}
}
/* create the item */
MenuItem2* menuitem = new MenuItem2(elem->Attribute("text"),
command, command ? &params: NULL);
// Create the item
AppMenuItem* menuitem = new AppMenuItem(elem->Attribute("text"),
command, command ? &params: NULL);
if (!menuitem)
return NULL;
@ -352,14 +356,14 @@ Widget* AppMenus::convertXmlelemToMenuitem(TiXmlElement* elem)
Widget* AppMenus::createInvalidVersionMenuitem()
{
MenuItem2* menuitem = new MenuItem2("WARNING!", NULL, NULL);
AppMenuItem* menuitem = new AppMenuItem("WARNING!", NULL, NULL);
Menu* subMenu = new Menu();
subMenu->addChild(new MenuItem2(PACKAGE " is using a customized gui.xml (maybe from your HOME directory).", NULL, NULL));
subMenu->addChild(new MenuItem2("You should update your customized gui.xml file to the new version to get", NULL, NULL));
subMenu->addChild(new MenuItem2("the latest commands available.", NULL, NULL));
subMenu->addChild(new AppMenuItem(PACKAGE " is using a customized gui.xml (maybe from your HOME directory).", NULL, NULL));
subMenu->addChild(new AppMenuItem("You should update your customized gui.xml file to the new version to get", NULL, NULL));
subMenu->addChild(new AppMenuItem("the latest commands available.", NULL, NULL));
subMenu->addChild(new Separator(NULL, JI_HORIZONTAL));
subMenu->addChild(new MenuItem2("You can bypass this validation adding the correct version", NULL, NULL));
subMenu->addChild(new MenuItem2("number in <gui version=\"" VERSION "\"> element.", NULL, NULL));
subMenu->addChild(new AppMenuItem("You can bypass this validation adding the correct version", NULL, NULL));
subMenu->addChild(new AppMenuItem("number in <gui version=\"" VERSION "\"> element.", NULL, NULL));
menuitem->setSubmenu(subMenu);
return menuitem;
}
@ -370,9 +374,9 @@ void AppMenus::applyShortcutToMenuitemsWithCommand(Menu* menu, Command *command,
Widget* child = *it;
if (child->getType() == kMenuItemWidget) {
ASSERT(dynamic_cast<MenuItem2*>(child) != NULL);
ASSERT(dynamic_cast<AppMenuItem*>(child) != NULL);
MenuItem2* menuitem = static_cast<MenuItem2*>(child);
AppMenuItem* menuitem = static_cast<AppMenuItem*>(child);
Command* mi_command = menuitem->getCommand();
Params* mi_params = menuitem->getParams();
@ -389,3 +393,5 @@ void AppMenus::applyShortcutToMenuitemsWithCommand(Menu* menu, Command *command,
}
}
}
} // namespace app

79
src/app/app_menus.h Normal file
View File

@ -0,0 +1,79 @@
/* ASEPRITE
* Copyright (C) 2001-2013 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 APP_APP_MENUS_H_INCLUDED
#define APP_APP_MENUS_H_INCLUDED
#include "base/disable_copying.h"
#include "base/unique_ptr.h"
#include "ui/base.h"
#include "ui/menu.h"
class TiXmlElement;
class TiXmlHandle;
namespace ui {
class Accelerator;
}
namespace app {
class Command;
class Params;
using namespace ui;
// Class to handle/get/reload available menus in gui.xml file.
class AppMenus {
AppMenus();
DISABLE_COPYING(AppMenus);
public:
static AppMenus* instance();
void reload();
// Updates the menu of recent files.
bool rebuildRecentList();
Menu* getRootMenu() { return m_rootMenu; }
MenuItem* getRecentListMenuitem() { return m_recentListMenuitem; }
Menu* getDocumentTabPopupMenu() { return m_documentTabPopupMenu; }
Menu* getLayerPopupMenu() { return m_layerPopupMenu; }
Menu* getFramePopupMenu() { return m_framePopupMenu; }
Menu* getCelPopupMenu() { return m_celPopupMenu; }
Menu* getCelMovementPopupMenu() { return m_celMovementPopupMenu; }
private:
Menu* loadMenuById(TiXmlHandle& handle, const char *id);
Menu* convertXmlelemToMenu(TiXmlElement* elem);
Widget* convertXmlelemToMenuitem(TiXmlElement* elem);
Widget* createInvalidVersionMenuitem();
void applyShortcutToMenuitemsWithCommand(Menu* menu, Command* command, Params* params, Accelerator* accel);
base::UniquePtr<Menu> m_rootMenu;
MenuItem* m_recentListMenuitem;
base::UniquePtr<Menu> m_documentTabPopupMenu;
base::UniquePtr<Menu> m_layerPopupMenu;
base::UniquePtr<Menu> m_framePopupMenu;
base::UniquePtr<Menu> m_celPopupMenu;
base::UniquePtr<Menu> m_celMovementPopupMenu;
};
} // namespace app
#endif

View File

@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/app_options.h"

View File

@ -53,6 +53,6 @@ private:
std::string m_paletteFileName;
};
}
} // namespace app
#endif

View File

@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/backup.h"

View File

@ -16,15 +16,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef ENABLE_UPDATER
#include "app/check_update.h"
#include "app/ini_file.h"
#include "app/ui/status_bar.h"
#include "base/bind.h"
#include "ini_file.h"
#include "widgets/status_bar.h"
#include <ctime>
#include <sstream>

View File

@ -30,8 +30,7 @@ namespace app {
class CheckUpdateBackgroundJob;
class CheckUpdateThreadLauncher
{
class CheckUpdateThreadLauncher {
public:
CheckUpdateThreadLauncher();
~CheckUpdateThreadLauncher();
@ -50,8 +49,8 @@ namespace app {
void checkForUpdates();
updater::Uuid m_uuid;
UniquePtr<base::thread> m_thread;
UniquePtr<CheckUpdateBackgroundJob> m_bgJob;
base::UniquePtr<base::thread> m_thread;
base::UniquePtr<CheckUpdateBackgroundJob> m_bgJob;
bool m_doCheck;
bool m_received;
updater::CheckUpdateResponse m_response;
@ -65,7 +64,7 @@ namespace app {
bool m_isDeveloper;
};
}
} // namespace app
#endif // ENABLE_UPDATER

View File

@ -16,25 +16,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <string>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#endif
#include "app/color.h"
#include "app/color_utils.h"
#include "app/modules/palettes.h"
#include "gfx/hsv.h"
#include "gfx/rgb.h"
#include "modules/palettes.h"
#include "raster/image.h"
#include "raster/palette.h"
using namespace gfx;
#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <string>
namespace app {
using namespace gfx;
// static
Color Color::fromMask()
{

View File

@ -23,82 +23,86 @@
#include <string>
class Image;
class Layer;
namespace raster {
class Image;
class Layer;
}
namespace app {
class Color {
public:
enum Type {
MaskType,
RgbType,
HsvType,
GrayType,
IndexType,
using namespace raster;
class Color {
public:
enum Type {
MaskType,
RgbType,
HsvType,
GrayType,
IndexType,
};
enum HumanReadableString {
ShortHumanReadableString,
LongHumanReadableString
};
// Default ctor is mask color
Color() : m_type(MaskType) { }
static Color fromMask();
static Color fromRgb(int r, int g, int b);
static Color fromHsv(int h, int s, int v); // h=[0,360], s=[0,100], v=[0,100]
static Color fromGray(int g);
static Color fromIndex(int index);
static Color fromImage(PixelFormat pixelFormat, int pixel);
static Color fromImageGetPixel(Image* image, int x, int y);
static Color fromString(const std::string& str);
std::string toString() const;
std::string toHumanReadableString(PixelFormat format, HumanReadableString type) const;
bool operator==(const Color& other) const;
bool operator!=(const Color& other) const {
return !operator==(other);
}
Type getType() const {
return m_type;
}
bool isValid() const;
// Getters
int getRed() const;
int getGreen() const;
int getBlue() const;
int getHue() const;
int getSaturation() const;
int getValue() const;
int getGray() const;
int getIndex() const;
private:
Color(Type type) : m_type(type) { }
// Color type
Type m_type;
// Color value
union {
struct {
int r, g, b;
} rgb;
struct {
int h, s, v;
} hsv;
int gray;
int index;
} m_value;
};
enum HumanReadableString {
ShortHumanReadableString,
LongHumanReadableString
};
// Default ctor is mask color
Color() : m_type(MaskType) { }
static Color fromMask();
static Color fromRgb(int r, int g, int b);
static Color fromHsv(int h, int s, int v); // h=[0,360], s=[0,100], v=[0,100]
static Color fromGray(int g);
static Color fromIndex(int index);
static Color fromImage(PixelFormat pixelFormat, int pixel);
static Color fromImageGetPixel(Image* image, int x, int y);
static Color fromString(const std::string& str);
std::string toString() const;
std::string toHumanReadableString(PixelFormat format, HumanReadableString type) const;
bool operator==(const Color& other) const;
bool operator!=(const Color& other) const {
return !operator==(other);
}
Type getType() const {
return m_type;
}
bool isValid() const;
// Getters
int getRed() const;
int getGreen() const;
int getBlue() const;
int getHue() const;
int getSaturation() const;
int getValue() const;
int getGray() const;
int getIndex() const;
private:
Color(Type type) : m_type(type) { }
// Color type
Type m_type;
// Color value
union {
struct {
int r, g, b;
} rgb;
struct {
int h, s, v;
} hsv;
int gray;
int index;
} m_value;
};
}
} // namespace app
#endif

View File

@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/color_swatches.h"

View File

@ -16,19 +16,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <allegro.h>
#include "app/color_utils.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "app/modules/palettes.h"
#include "gfx/hsv.h"
#include "gfx/rgb.h"
#include "modules/palettes.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "raster/palette.h"
#include "raster/sprite.h"
using namespace gfx;
@ -52,6 +54,8 @@ int get_mask_for_bitmap(int depth)
}
namespace app {
ui::Color color_utils::blackandwhite(ui::Color color)
{
if ((ui::getr(color)*30+ui::getg(color)*59+ui::getb(color)*11)/100 < 128)
@ -215,3 +219,5 @@ int color_utils::fixup_color_for_background(PixelFormat format, int color)
}
return color;
}
} // namespace app

View File

@ -23,21 +23,25 @@
#include "raster/pixel_format.h"
#include "ui/color.h"
class Layer;
namespace color_utils {
ui::Color blackandwhite(ui::Color color);
ui::Color blackandwhite_neg(ui::Color color);
ui::Color color_for_ui(const app::Color& color);
int color_for_allegro(const app::Color& color, int depth);
int color_for_image(const app::Color& color, PixelFormat format);
int color_for_layer(const app::Color& color, Layer* layer);
int fixup_color_for_layer(Layer* layer, int color);
int fixup_color_for_background(PixelFormat format, int color);
namespace raster {
class Layer;
}
namespace app {
namespace color_utils {
ui::Color blackandwhite(ui::Color color);
ui::Color blackandwhite_neg(ui::Color color);
ui::Color color_for_ui(const app::Color& color);
int color_for_allegro(const app::Color& color, int depth);
int color_for_image(const app::Color& color, raster::PixelFormat format);
int color_for_layer(const app::Color& color, raster::Layer* layer);
int fixup_color_for_layer(raster::Layer* layer, int color);
int fixup_color_for_background(raster::PixelFormat format, int color);
} // namespace color_utils
} // namespace app
#endif

View File

@ -16,21 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/modules/gui.h"
#include "base/bind.h"
#include "ui/gui.h"
#include "ui/ui.h"
#include "commands/command.h"
#include "modules/gui.h"
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// about
class AboutCommand : public Command
{
class AboutCommand : public Command {
public:
AboutCommand();
Command* clone() const { return new AboutCommand(*this); }
@ -48,7 +47,7 @@ AboutCommand::AboutCommand()
void AboutCommand::onExecute(Context* context)
{
UniquePtr<Window> window(new Window(false, "About " PACKAGE));
base::UniquePtr<Window> window(new Window(false, "About " PACKAGE));
Box* box1 = new Box(JI_VERTICAL);
Grid* grid = new Grid(2, false);
Label* title = new Label(PACKAGE " v" VERSION);
@ -103,10 +102,9 @@ void AboutCommand::onExecute(Context* context)
window->openWindowInForeground();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createAboutCommand()
{
return new AboutCommand;
}
} // namespace app

View File

@ -16,23 +16,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "commands/command.h"
#include "ini_file.h"
#include "modules/gui.h"
#include "ui/gui.h"
#include "widgets/main_window.h"
#include "app/modules/gui.h"
#include "app/ui/main_window.h"
#include "ui/ui.h"
#include <cstdio>
namespace app {
using namespace ui;
class AdvancedModeCommand : public Command
{
class AdvancedModeCommand : public Command {
public:
AdvancedModeCommand();
Command* clone() const { return new AdvancedModeCommand(*this); }
@ -62,7 +65,7 @@ void AdvancedModeCommand::onExecute(Context* context)
char warning[1024];
char buf[1024];
UniquePtr<Window> window(app::load_widget<Window>("advanced_mode.xml", "advanced_mode_warning"));
base::UniquePtr<Window> window(app::load_widget<Window>("advanced_mode.xml", "advanced_mode_warning"));
Widget* warning_label = app::find_widget<Widget>(window, "warning_label");
Widget* donot_show = app::find_widget<Widget>(window, "donot_show");
@ -78,10 +81,9 @@ void AdvancedModeCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createAdvancedModeCommand()
{
return new AdvancedModeCommand;
}
} // namespace app

View File

@ -16,21 +16,25 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/color_utils.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "document_location.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/document_location.h"
#include "app/modules/gui.h"
#include "app/settings/settings.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include "widgets/color_bar.h"
class BackgroundFromLayerCommand : public Command
{
namespace app {
class BackgroundFromLayerCommand : public Command {
public:
BackgroundFromLayerCommand();
Command* clone() const { return new BackgroundFromLayerCommand(*this); }
@ -77,10 +81,9 @@ void BackgroundFromLayerCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createBackgroundFromLayerCommand()
{
return new BackgroundFromLayerCommand;
}
} // namespace app

View File

@ -16,15 +16,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "app/commands/command.h"
#include "commands/commands.h"
#include "context.h"
#include "app/commands/commands.h"
#include "app/context.h"
class CancelCommand : public Command
{
namespace app {
class CancelCommand : public Command {
public:
CancelCommand();
Command* clone() { return new CancelCommand(*this); }
@ -49,10 +52,9 @@ void CancelCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCancelCommand()
{
return new CancelCommand;
}
} // namespace app

View File

@ -16,29 +16,34 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/color_utils.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/settings/settings.h"
#include "app/ui/color_bar.h"
#include "app/ui/editor/editor.h"
#include "app/ui/editor/select_box_state.h"
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/color_bar.h"
#include "widgets/editor/editor.h"
#include "widgets/editor/select_box_state.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;
// Disable warning about usage of "this" in initializer list.
@ -139,10 +144,7 @@ private:
EditorStatePtr m_selectBoxState;
};
//////////////////////////////////////////////////////////////////////
class CanvasSizeCommand : public Command
{
class CanvasSizeCommand : public Command {
int m_left, m_right, m_top, m_bottom;
public:
@ -175,7 +177,7 @@ void CanvasSizeCommand::onExecute(Context* context)
if (context->isUiAvailable()) {
// load the window widget
UniquePtr<CanvasSizeWindow> window(new CanvasSizeWindow(0, 0, 0, 0));
base::UniquePtr<CanvasSizeWindow> window(new CanvasSizeWindow(0, 0, 0, 0));
window->remapWindow();
window->centerWindow();
@ -221,10 +223,9 @@ void CanvasSizeCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCanvasSizeCommand()
{
return new CanvasSizeCommand;
}
} // namespace app

View File

@ -16,30 +16,33 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_cel_opacity.h"
#include "base/mem_utils.h"
#include "commands/command.h"
#include "context_access.h"
#include "modules/gui.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "undoers/set_cel_opacity.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;
class CelPropertiesCommand : public Command
{
class CelPropertiesCommand : public Command {
public:
CelPropertiesCommand();
Command* clone() const { return new CelPropertiesCommand(*this); }
@ -70,7 +73,7 @@ void CelPropertiesCommand::onExecute(Context* context)
const Layer* layer = reader.layer();
const Cel* cel = reader.cel(); // Get current cel (can be NULL)
UniquePtr<Window> window(app::load_widget<Window>("cel_properties.xml", "cel_properties"));
base::UniquePtr<Window> window(app::load_widget<Window>("cel_properties.xml", "cel_properties"));
Widget* label_frame = app::find_widget<Widget>(window, "frame");
Widget* label_pos = app::find_widget<Widget>(window, "pos");
Widget* label_size = app::find_widget<Widget>(window, "size");
@ -104,7 +107,7 @@ void CelPropertiesCommand::onExecute(Context* context)
label_size->setTextf("%dx%d (%s)",
sprite->getStock()->getImage(cel->getImage())->w,
sprite->getStock()->getImage(cel->getImage())->h,
get_pretty_memory_size(memsize).c_str());
base::get_pretty_memory_size(memsize).c_str());
// Opacity
slider_opacity->setValue(cel->getOpacity());
@ -149,10 +152,9 @@ void CelPropertiesCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCelPropertiesCommand()
{
return new CelPropertiesCommand;
}
} // namespace app

View File

@ -16,15 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include "commands/command.h"
#include "commands/params.h"
#include "app.h"
#include "widgets/color_bar.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/ui/color_bar.h"
namespace app {
class ChangeColorCommand : public Command
{
enum Change {
@ -104,10 +108,9 @@ void ChangeColorCommand::onExecute(Context* context)
colorbar->setFgColor(color);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createChangeColorCommand()
{
return new ChangeColorCommand;
}
} // namespace app

View File

@ -16,24 +16,27 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "commands/params.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/undo_transaction.h"
#include "raster/dithering_method.h"
#include "raster/image.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include <allegro/unicode.h>
class ChangePixelFormatCommand : public Command
{
namespace app {
class ChangePixelFormatCommand : public Command {
PixelFormat m_format;
DitheringMethod m_dithering;
public:
@ -114,10 +117,9 @@ void ChangePixelFormatCommand::onExecute(Context* context)
app_refresh_screen();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createChangePixelFormatCommand()
{
return new ChangePixelFormatCommand;
}
} // namespace app

View File

@ -16,19 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include "app.h"
#include "commands/command.h"
#include "commands/params.h"
#include "context.h"
#include "settings/settings.h"
#include "tools/tool.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context.h"
#include "app/settings/settings.h"
#include "app/tools/tool.h"
class ChangePenCommand : public Command
{
namespace app {
class ChangePenCommand : public Command {
enum Change {
None,
IncrementSize,
@ -93,10 +96,9 @@ void ChangePenCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createChangePenCommand()
{
return new ChangePenCommand;
}
} // namespace app

View File

@ -16,25 +16,25 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "document_location.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/document_location.h"
#include "app/modules/gui.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "undo/undo_history.h"
#include "undo_transaction.h"
#include "widgets/color_bar.h"
//////////////////////////////////////////////////////////////////////
// ClearCommand
namespace app {
class ClearCommand : public Command
{
class ClearCommand : public Command {
public:
ClearCommand();
Command* clone() const { return new ClearCommand(*this); }
@ -79,10 +79,9 @@ void ClearCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createClearCommand()
{
return new ClearCommand;
}
} // namespace app

View File

@ -16,35 +16,34 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/context_access.h"
#include "app/document_access.h"
#include "app/modules/editors.h"
#include "app/ui/document_view.h"
#include "app/ui/main_window.h"
#include "app/ui/status_bar.h"
#include "app/ui/workspace.h"
#include "app/ui_context.h"
#include "base/path.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "context_access.h"
#include "document_access.h"
#include "modules/editors.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "widgets/document_view.h"
#include "widgets/main_window.h"
#include "widgets/status_bar.h"
#include "widgets/workspace.h"
#include "ui/ui.h"
#include <memory>
namespace app {
using namespace ui;
using namespace widgets;
static bool close_active_document(Context* context);
//////////////////////////////////////////////////////////////////////
// close_file
class CloseFileCommand : public Command
{
class CloseFileCommand : public Command {
public:
CloseFileCommand()
: Command("CloseFile",
@ -91,11 +90,7 @@ private:
static char* read_authors_txt(const char *filename);
};
//////////////////////////////////////////////////////////////////////
// close_all_files
class CloseAllFilesCommand : public Command
{
class CloseAllFilesCommand : public Command {
public:
CloseAllFilesCommand()
: Command("CloseAllFiles",
@ -127,8 +122,6 @@ protected:
};
//////////////////////////////////////////////////////////////////////
// Closes the active document, asking to the user to save it if it is
// modified.
static bool close_active_document(Context* context)
@ -192,9 +185,6 @@ static bool close_active_document(Context* context)
return true;
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCloseFileCommand()
{
return new CloseFileCommand;
@ -204,3 +194,5 @@ Command* CommandFactory::createCloseAllFilesCommand()
{
return new CloseAllFilesCommand;
}
} // namespace app

View File

@ -16,33 +16,37 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "app/modules/gfx.h"
#include "app/modules/gui.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "app/ui/color_button.h"
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "app/ui_context.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "console.h"
#include "context_access.h"
#include "gfx/size.h"
#include "modules/gfx.h"
#include "modules/gui.h"
#include "raster/mask.h"
#include "settings/document_settings.h"
#include "settings/settings.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "widgets/color_button.h"
#include "widgets/editor/editor.h"
#include "widgets/status_bar.h"
#include "ui/ui.h"
#include <allegro.h>
namespace app {
using namespace gfx;
using namespace ui;
using namespace tools;
using namespace app::tools;
static Window* window = NULL;
@ -55,10 +59,7 @@ static void on_exit_delete_this_widget()
delete window;
}
//////////////////////////////////////////////////////////////////////
class ConfigureTools : public Command
{
class ConfigureTools : public Command {
public:
ConfigureTools();
Command* clone() const { return new ConfigureTools(*this); }
@ -134,10 +135,10 @@ void ConfigureTools::onExecute(Context* context)
Tool* current_tool = m_settings->getCurrentTool();
IToolSettings* tool_settings = m_settings->getToolSettings(current_tool);
if (m_docSettings->getTiledMode() != TILED_NONE) {
if (m_docSettings->getTiledMode() != filters::TILED_NONE) {
m_tiled->setSelected(true);
if (m_docSettings->getTiledMode() & TILED_X_AXIS) m_tiledX->setSelected(true);
if (m_docSettings->getTiledMode() & TILED_Y_AXIS) m_tiledY->setSelected(true);
if (m_docSettings->getTiledMode() & filters::TILED_X_AXIS) m_tiledX->setSelected(true);
if (m_docSettings->getTiledMode() & filters::TILED_Y_AXIS) m_tiledY->setSelected(true);
}
if (m_docSettings->getSnapToGrid()) m_snapToGrid->setSelected(true);
@ -149,8 +150,8 @@ void ConfigureTools::onExecute(Context* context)
// Slots
window->Close.connect(Bind<void>(&ConfigureTools::onWindowClose, this));
m_tiled->Click.connect(Bind<void>(&ConfigureTools::onTiledClick, this));
m_tiledX->Click.connect(Bind<void>(&ConfigureTools::onTiledXYClick, this, TILED_X_AXIS, m_tiledX));
m_tiledY->Click.connect(Bind<void>(&ConfigureTools::onTiledXYClick, this, TILED_Y_AXIS, m_tiledY));
m_tiledX->Click.connect(Bind<void>(&ConfigureTools::onTiledXYClick, this, filters::TILED_X_AXIS, m_tiledX));
m_tiledY->Click.connect(Bind<void>(&ConfigureTools::onTiledXYClick, this, filters::TILED_Y_AXIS, m_tiledY));
m_viewGrid->Click.connect(Bind<void>(&ConfigureTools::onViewGridClick, this));
m_pixelGrid->Click.connect(Bind<void>(&ConfigureTools::onPixelGridClick, this));
set_grid->Click.connect(Bind<void>(&ConfigureTools::onSetGridClick, this));
@ -179,7 +180,8 @@ void ConfigureTools::onTiledClick()
{
bool flag = m_tiled->isSelected();
m_docSettings->setTiledMode(flag ? TILED_BOTH: TILED_NONE);
m_docSettings->setTiledMode(flag ? filters::TILED_BOTH:
filters::TILED_NONE);
m_tiledX->setSelected(flag);
m_tiledY->setSelected(flag);
@ -194,9 +196,9 @@ void ConfigureTools::onTiledXYClick(int tiled_axis, CheckBox* checkbox)
else
tiled_mode &= ~tiled_axis;
checkbox->findSibling("tiled")->setSelected(tiled_mode != TILED_NONE);
checkbox->findSibling("tiled")->setSelected(tiled_mode != filters::TILED_NONE);
m_docSettings->setTiledMode((TiledMode)tiled_mode);
m_docSettings->setTiledMode((filters::TiledMode)tiled_mode);
}
void ConfigureTools::onSnapToGridClick()
@ -243,10 +245,9 @@ void ConfigureTools::onOnionSkinClick()
m_docSettings->setUseOnionskin(m_onionSkin->isSelected());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createConfigureToolsCommand()
{
return new ConfigureTools;
}
} // namespace app

View File

@ -16,19 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/util/clipboard.h"
#include "app/util/misc.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/base.h"
#include "util/clipboard.h"
#include "util/misc.h"
class CopyCommand : public Command
{
namespace app {
class CopyCommand : public Command {
public:
CopyCommand();
Command* clone() const { return new CopyCommand(*this); }
@ -57,13 +60,12 @@ bool CopyCommand::onEnabled(Context* context)
void CopyCommand::onExecute(Context* context)
{
const ContextReader reader(context);
util::clipboard::copy(reader);
clipboard::copy(reader);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCopyCommand()
{
return new CopyCommand;
}
} // namespace app

View File

@ -16,16 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "dialogs/aniedit.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/dialogs/aniedit.h"
#include "app/util/celmove.h"
#include "ui/base.h"
#include "util/celmove.h"
class CopyCelCommand : public Command
{
namespace app {
class CopyCelCommand : public Command {
public:
CopyCelCommand();
Command* clone() const { return new CopyCelCommand(*this); }
@ -53,10 +56,9 @@ void CopyCelCommand::onExecute(Context* context)
copy_cel(writer);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCopyCelCommand()
{
return new CopyCelCommand;
}
} // namespace app

View File

@ -16,28 +16,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/color_utils.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "app/util/autocrop.h"
#include "app/util/misc.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include "util/autocrop.h"
#include "util/misc.h"
#include "widgets/color_bar.h"
//////////////////////////////////////////////////////////////////////
// crop_sprite
namespace app {
class CropSpriteCommand : public Command
{
class CropSpriteCommand : public Command {
public:
CropSpriteCommand();
Command* clone() const { return new CropSpriteCommand(*this); }
@ -78,11 +78,7 @@ void CropSpriteCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// autocrop_sprite
class AutocropSpriteCommand : public Command
{
class AutocropSpriteCommand : public Command {
public:
AutocropSpriteCommand();
Command* clone() const { return new AutocropSpriteCommand(*this); }
@ -122,9 +118,6 @@ void AutocropSpriteCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCropSpriteCommand()
{
return new CropSpriteCommand;
@ -134,3 +127,5 @@ Command* CommandFactory::createAutocropSpriteCommand()
{
return new AutocropSpriteCommand;
}
} // namespace app

View File

@ -16,19 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/util/clipboard.h"
#include "app/util/misc.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/base.h"
#include "util/clipboard.h"
#include "util/misc.h"
class CutCommand : public Command
{
namespace app {
class CutCommand : public Command {
public:
CutCommand();
Command* clone() const { return new CutCommand(*this); }
@ -57,13 +60,12 @@ bool CutCommand::onEnabled(Context* context)
void CutCommand::onExecute(Context* context)
{
ContextWriter writer(context);
util::clipboard::cut(writer);
clipboard::cut(writer);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createCutCommand()
{
return new CutCommand;
}
} // namespace app

View File

@ -16,21 +16,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
//////////////////////////////////////////////////////////////////////
// deselect_mask
namespace app {
class DeselectMaskCommand : public Command
{
class DeselectMaskCommand : public Command {
public:
DeselectMaskCommand();
Command* clone() const { return new DeselectMaskCommand(*this); }
@ -66,10 +66,9 @@ void DeselectMaskCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createDeselectMaskCommand()
{
return new DeselectMaskCommand;
}
} // namespace app

View File

@ -16,21 +16,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context.h"
#include "document.h"
#include "documents.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/document.h"
#include "app/documents.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/combobox.h"
#include "ui/window.h"
namespace app {
using namespace ui;
class DeveloperConsole : public Window
{
class DeveloperConsole : public Window {
public:
DeveloperConsole()
: Window(false, "Developer Console")
@ -60,8 +63,7 @@ private:
ComboBox m_docs;
};
class DeveloperConsoleCommand : public Command
{
class DeveloperConsoleCommand : public Command {
public:
DeveloperConsoleCommand();
~DeveloperConsoleCommand();
@ -99,10 +101,9 @@ void DeveloperConsoleCommand::onExecute(Context* context)
m_devConsole->openWindow();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createDeveloperConsoleCommand()
{
return new DeveloperConsoleCommand;
}
} // namespace app

View File

@ -16,29 +16,29 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "console.h"
#include "context_access.h"
#include "document_api.h"
#include "document_undo.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/document_undo.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "app/undo_transaction.h"
#include "app/undoers/add_layer.h"
#include "app/undoers/move_layer.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "undoers/add_layer.h"
#include "undoers/move_layer.h"
#include "widgets/editor/editor.h"
#include "ui/ui.h"
//////////////////////////////////////////////////////////////////////
// Duplicate Layer command
namespace app {
class DuplicateLayerCommand : public Command
{
class DuplicateLayerCommand : public Command {
public:
DuplicateLayerCommand();
Command* clone() const { return new DuplicateLayerCommand(*this); }
@ -71,7 +71,7 @@ void DuplicateLayerCommand::onExecute(Context* context)
LayerImage* sourceLayer = static_cast<LayerImage*>(writer.layer());
// Create a new layer
UniquePtr<LayerImage> newLayerPtr(new LayerImage(sprite));
base::UniquePtr<LayerImage> newLayerPtr(new LayerImage(sprite));
// Disable undo because the layer content is added as a whole with
// AddLayer() undoer.
@ -97,10 +97,9 @@ void DuplicateLayerCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createDuplicateLayerCommand()
{
return new DuplicateLayerCommand;
}
} // namespace app

View File

@ -16,29 +16,29 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "commands/command.h"
#include "context_access.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "app/modules/editors.h"
#include "app/ui_context.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "ui/ui.h"
#include <allegro.h>
#include <cstdio>
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// duplicate_sprite
class DuplicateSpriteCommand : public Command
{
class DuplicateSpriteCommand : public Command {
public:
DuplicateSpriteCommand();
Command* clone() { return new DuplicateSpriteCommand(*this); }
@ -68,7 +68,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
char buf[1024];
/* load the window widget */
UniquePtr<Window> window(app::load_widget<Window>("duplicate_sprite.xml", "duplicate_sprite"));
base::UniquePtr<Window> window(app::load_widget<Window>("duplicate_sprite.xml", "duplicate_sprite"));
src_name = window->findChild("src_name");
dst_name = window->findChild("dst_name");
@ -101,10 +101,9 @@ void DuplicateSpriteCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createDuplicateSpriteCommand()
{
return new DuplicateSpriteCommand;
}
} // namespace app

View File

@ -16,20 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "context.h"
#include "document.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/document.h"
#include "app/ui/main_window.h"
#include "ui/alert.h"
#include "widgets/main_window.h"
//////////////////////////////////////////////////////////////////////
// exit
namespace app {
class ExitCommand : public Command
{
class ExitCommand : public Command {
public:
ExitCommand();
Command* clone() { return new ExitCommand(*this); }
@ -67,10 +67,9 @@ void ExitCommand::onExecute(Context* context)
App::instance()->getMainWindow()->closeWindow(NULL);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createExitCommand()
{
return new ExitCommand;
}
} // namespace app

View File

@ -16,39 +16,39 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/document_api.h"
#include "app/document_undo.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/ui/editor/editor.h"
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "context.h"
#include "context_access.h"
#include "document.h"
#include "document_api.h"
#include "document_undo.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/editor/editor.h"
#include "ui/ui.h"
#include <limits>
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// ExportSpriteSheetFrame
class ExportSpriteSheetWindow : public Window
{
class ExportSpriteSheetWindow : public Window {
enum SpriteSheetType { HorizontalStrip, VerticalStrip, Matrix };
enum ExportAction { SaveCopyAs, SaveAs, Save, DoNotSave };
@ -144,8 +144,8 @@ protected:
int sheet_w = sprite->getWidth()*columns;
int sheet_h = sprite->getHeight()*((nframes/columns)+((nframes%columns)>0?1:0));
UniquePtr<Image> resultImage(Image::create(sprite->getPixelFormat(), sheet_w, sheet_h));
UniquePtr<Image> tempImage(Image::create(sprite->getPixelFormat(), sprite->getWidth(), sprite->getHeight()));
base::UniquePtr<Image> resultImage(Image::create(sprite->getPixelFormat(), sheet_w, sheet_h));
base::UniquePtr<Image> tempImage(Image::create(sprite->getPixelFormat(), sprite->getWidth(), sprite->getHeight()));
image_clear(resultImage, 0);
int column = 0, row = 0;
@ -182,7 +182,7 @@ protected:
resultImage.release();
// Create the cel.
UniquePtr<Cel> resultCel(new Cel(FrameNumber(0), indexInStock));
base::UniquePtr<Cel> resultCel(new Cel(FrameNumber(0), indexInStock));
// Add the cel in the layer.
api.addCel(resultLayer, resultCel);
@ -309,11 +309,7 @@ private:
Button m_cancel;
};
//////////////////////////////////////////////////////////////////////
// ExportSpriteSheetCommand
class ExportSpriteSheetCommand : public Command
{
class ExportSpriteSheetCommand : public Command {
public:
ExportSpriteSheetCommand();
Command* clone() { return new ExportSpriteSheetCommand(*this); }
@ -337,14 +333,13 @@ bool ExportSpriteSheetCommand::onEnabled(Context* context)
void ExportSpriteSheetCommand::onExecute(Context* context)
{
UniquePtr<Window> window(new ExportSpriteSheetWindow(context));
base::UniquePtr<Window> window(new ExportSpriteSheetWindow(context));
window->openWindowInForeground();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createExportSpriteSheetCommand()
{
return new ExportSpriteSheetCommand;
}
} // namespace app

View File

@ -16,28 +16,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <allegro/unicode.h>
#include "ui/gui.h"
#include "ui/ui.h"
#include "app.h"
#include "commands/command.h"
#include "commands/params.h"
#include "modules/editors.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/modules/editors.h"
#include "app/ui/color_bar.h"
#include "app/ui/editor/editor.h"
#include "raster/image.h"
#include "raster/sprite.h"
#include "widgets/color_bar.h"
#include "widgets/editor/editor.h"
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// eyedropper
class EyedropperCommand : public Command
{
class EyedropperCommand : public Command {
/**
* True means "pick background color", false the foreground color.
*/
@ -97,10 +97,9 @@ void EyedropperCommand::onExecute(Context* context)
ColorBar::instance()->setFgColor(color);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createEyedropperCommand()
{
return new EyedropperCommand;
}
} // namespace app

View File

@ -16,19 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ui/gui.h"
#include "ui/ui.h"
#include "commands/command.h"
#include "context.h"
#include "dialogs/aniedit.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/dialogs/aniedit.h"
//////////////////////////////////////////////////////////////////////
// film_editor
namespace app {
class FilmEditorCommand : public Command
{
class FilmEditorCommand : public Command {
public:
FilmEditorCommand();
Command* clone() { return new FilmEditorCommand(*this); }
@ -55,10 +55,9 @@ void FilmEditorCommand::onExecute(Context* context)
switch_between_animation_and_sprite_editor(context);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createFilmEditorCommand()
{
return new FilmEditorCommand;
}
} // namespace app

View File

@ -16,23 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/color_utils.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include "widgets/color_bar.h"
//////////////////////////////////////////////////////////////////////
// flatten_layers
namespace app {
class FlattenLayersCommand : public Command
{
class FlattenLayersCommand : public Command {
public:
FlattenLayersCommand();
Command* clone() { return new FlattenLayersCommand(*this); }
@ -69,10 +69,9 @@ void FlattenLayersCommand::onExecute(Context* context)
update_screen_for_document(writer.document());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createFlattenLayersCommand()
{
return new FlattenLayersCommand;
}
} // namespace app

View File

@ -16,23 +16,27 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/cmd_flip.h"
#include "app/commands/cmd_flip.h"
#include "app.h"
#include "commands/params.h"
#include "context_access.h"
#include "document_api.h"
#include "app/app.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "gfx/size.h"
#include "modules/gui.h"
#include "raster/algorithm/flip_image.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "undo_transaction.h"
namespace app {
FlipCommand::FlipCommand()
: Command("Flip",
@ -115,7 +119,7 @@ void FlipCommand::onExecute(Context* context)
Image* maskBitmap = mask->getBitmap();
if (maskBitmap != NULL) {
// Create a flipped copy of the current mask.
UniquePtr<Mask> newMask(new Mask(*mask));
base::UniquePtr<Mask> newMask(new Mask(*mask));
newMask->freeze();
raster::algorithm::flip_image(newMask->getBitmap(),
gfx::Rect(gfx::Point(0, 0),
@ -165,10 +169,9 @@ void FlipCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createFlipCommand()
{
return new FlipCommand;
}
} // namespace app

View File

@ -16,28 +16,31 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMANDS_CMD_FLIP_H_INCLUDED
#define COMMANDS_CMD_FLIP_H_INCLUDED
#ifndef APP_COMMANDS_CMD_FLIP_H_INCLUDED
#define APP_COMMANDS_CMD_FLIP_H_INCLUDED
#include "commands/command.h"
#include "app/commands/command.h"
#include "raster/algorithm/flip_type.h"
class FlipCommand : public Command
{
public:
FlipCommand();
Command* clone() const { return new FlipCommand(*this); }
namespace app {
raster::algorithm::FlipType getFlipType() const { return m_flipType; }
class FlipCommand : public Command {
public:
FlipCommand();
Command* clone() const { return new FlipCommand(*this); }
protected:
void onLoadParams(Params* params);
bool onEnabled(Context* context);
void onExecute(Context* context);
raster::algorithm::FlipType getFlipType() const { return m_flipType; }
private:
bool m_flipMask;
raster::algorithm::FlipType m_flipType;
};
protected:
void onLoadParams(Params* params);
bool onEnabled(Context* context);
void onExecute(Context* context);
#endif // COMMANDS_CMD_FLIP_H_INCLUDED
private:
bool m_flipMask;
raster::algorithm::FlipType m_flipType;
};
} // namespace app
#endif // APP_COMMANDS_CMD_FLIP_H_INCLUDED

View File

@ -16,26 +16,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "app/undo_transaction.h"
#include "base/convert_to.h"
#include "commands/command.h"
#include "commands/params.h"
#include "context_access.h"
#include "document_api.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "ui/ui.h"
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// frame_properties
class FramePropertiesCommand : public Command
{
class FramePropertiesCommand : public Command {
public:
FramePropertiesCommand();
Command* clone() { return new FramePropertiesCommand(*this); }
@ -90,7 +90,7 @@ void FramePropertiesCommand::onExecute(Context* context)
const ContextReader reader(context);
const Sprite* sprite = reader.sprite();
UniquePtr<Window> window(app::load_widget<Window>("frame_duration.xml", "frame_duration"));
base::UniquePtr<Window> window(app::load_widget<Window>("frame_duration.xml", "frame_duration"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* frlen = app::find_widget<Widget>(window, "frlen");
Widget* ok = app::find_widget<Widget>(window, "ok");
@ -140,10 +140,9 @@ void FramePropertiesCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createFramePropertiesCommand()
{
return new FramePropertiesCommand;
}
} // namespace app

View File

@ -16,24 +16,27 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "commands/command.h"
#include "commands/params.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "raster/sprite.h"
#include "ui/window.h"
#include "widgets/editor/editor.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;
class GotoCommand : public Command
{
class GotoCommand : public Command {
protected:
GotoCommand(const char* short_name, const char* friendly_name)
: Command(short_name, friendly_name, CmdRecordableFlag) { }
@ -145,7 +148,7 @@ protected:
FrameNumber onGetFrame(Editor* editor) OVERRIDE {
if (m_frame == 0) {
UniquePtr<Window> window(app::load_widget<Window>("goto_frame.xml", "goto_frame"));
base::UniquePtr<Window> window(app::load_widget<Window>("goto_frame.xml", "goto_frame"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* ok = app::find_widget<Widget>(window, "ok");
@ -167,9 +170,6 @@ private:
int m_frame;
};
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createGotoFirstFrameCommand()
{
return new GotoFirstFrameCommand;
@ -194,3 +194,5 @@ Command* CommandFactory::createGotoFrameCommand()
{
return new GotoFrameCommand;
}
} // namespace app

View File

@ -16,23 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "context_access.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "widgets/editor/editor.h"
#include "widgets/status_bar.h"
//////////////////////////////////////////////////////////////////////
// goto_previous_layer
namespace app {
class GotoPreviousLayerCommand : public Command
{
class GotoPreviousLayerCommand : public Command {
public:
GotoPreviousLayerCommand();
Command* clone() { return new GotoPreviousLayerCommand(*this); }
@ -76,11 +76,7 @@ void GotoPreviousLayerCommand::onExecute(Context* context)
location.layer()->getName().c_str());
}
//////////////////////////////////////////////////////////////////////
// goto_next_layer
class GotoNextLayerCommand : public Command
{
class GotoNextLayerCommand : public Command {
public:
GotoNextLayerCommand();
Command* clone() { return new GotoNextLayerCommand(*this); }
@ -124,9 +120,6 @@ void GotoNextLayerCommand::onExecute(Context* context)
location.layer()->getName().c_str());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createGotoPreviousLayerCommand()
{
return new GotoPreviousLayerCommand;
@ -136,3 +129,5 @@ Command* CommandFactory::createGotoNextLayerCommand()
{
return new GotoNextLayerCommand;
}
} // namespace app

View File

@ -16,16 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "app/commands/command.h"
#include "app.h"
#include "widgets/main_window.h"
#include "widgets/tabs.h"
#include "app/app.h"
#include "app/ui/main_window.h"
#include "app/ui/tabs.h"
class GotoNextTabCommand : public Command
{
namespace app {
class GotoNextTabCommand : public Command {
public:
GotoNextTabCommand();
Command* clone() { return new GotoNextTabCommand(*this); }
@ -46,12 +49,7 @@ void GotoNextTabCommand::onExecute(Context* context)
App::instance()->getMainWindow()->getTabsBar()->selectNextTab();
}
//////////////////////////////////////////////////////////////////////
// goto_previous_tab
class GotoPreviousTabCommand : public Command
{
class GotoPreviousTabCommand : public Command {
public:
GotoPreviousTabCommand();
Command* clone() { return new GotoPreviousTabCommand(*this); }
@ -72,9 +70,6 @@ void GotoPreviousTabCommand::onExecute(Context* context)
App::instance()->getMainWindow()->getTabsBar()->selectPreviousTab();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createGotoNextTabCommand()
{
return new GotoNextTabCommand;
@ -84,3 +79,5 @@ Command* CommandFactory::createGotoPreviousTabCommand()
{
return new GotoPreviousTabCommand;
}
} // namespace app

View File

@ -16,30 +16,30 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "commands/command.h"
#include "context.h"
#include "modules/editors.h"
#include "settings/document_settings.h"
#include "settings/settings.h"
#include "app/modules/editors.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "app/ui/status_bar.h"
#include "app/ui_context.h"
#include "ui/window.h"
#include "ui_context.h"
#include "widgets/status_bar.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;
using namespace gfx;
//////////////////////////////////////////////////////////////////////
// show_grid
class ShowGridCommand : public Command
{
class ShowGridCommand : public Command {
public:
ShowGridCommand()
: Command("ShowGrid",
@ -66,11 +66,7 @@ protected:
}
};
//////////////////////////////////////////////////////////////////////
// snap_to_grid
class SnapToGridCommand : public Command
{
class SnapToGridCommand : public Command {
public:
SnapToGridCommand()
: Command("SnapToGrid",
@ -103,11 +99,7 @@ protected:
}
};
//////////////////////////////////////////////////////////////////////
// grid_settings
class GridSettingsCommand : public Command
{
class GridSettingsCommand : public Command {
public:
GridSettingsCommand();
Command* clone() const { return new GridSettingsCommand(*this); }
@ -131,7 +123,7 @@ bool GridSettingsCommand::onEnabled(Context* context)
void GridSettingsCommand::onExecute(Context* context)
{
UniquePtr<Window> window(app::load_widget<Window>("grid_settings.xml", "grid_settings"));
base::UniquePtr<Window> window(app::load_widget<Window>("grid_settings.xml", "grid_settings"));
Widget* button_ok = app::find_widget<Widget>(window, "ok");
Widget* grid_x = app::find_widget<Widget>(window, "grid_x");
Widget* grid_y = app::find_widget<Widget>(window, "grid_y");
@ -160,9 +152,6 @@ void GridSettingsCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createShowGridCommand()
{
return new ShowGridCommand;
@ -177,3 +166,5 @@ Command* CommandFactory::createGridSettingsCommand()
{
return new GridSettingsCommand;
}
} // namespace app

View File

@ -16,45 +16,45 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/commands/params.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document_access.h"
#include "app/document_api.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/ui/drop_down_button.h"
#include "app/ui/editor/editor.h"
#include "app/ui/editor/editor_decorator.h"
#include "app/ui/editor/select_box_state.h"
#include "app/ui/editor/standby_state.h"
#include "app/ui/workspace.h"
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "commands/params.h"
#include "context.h"
#include "context_access.h"
#include "document_access.h"
#include "document_api.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/drop_down_button.h"
#include "widgets/editor/editor.h"
#include "widgets/editor/editor_decorator.h"
#include "widgets/editor/select_box_state.h"
#include "widgets/editor/standby_state.h"
#include "widgets/workspace.h"
#include "ui/ui.h"
#include <allegro/color.h>
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// ImportSpriteSheetWindow
class ImportSpriteSheetWindow : public Window,
public SelectBoxDelegate
{
public SelectBoxDelegate {
public:
ImportSpriteSheetWindow(Context* context)
: Window(false, "Import Sprite Sheet")
@ -165,7 +165,7 @@ protected:
// As first step, we cut each tile and add them into "animation" list.
for (int y=m_rect.y; y<sprite->getHeight(); y += m_rect.h) {
for (int x=m_rect.x; x<sprite->getWidth(); x += m_rect.w) {
UniquePtr<Image> resultImage(Image::create(sprite->getPixelFormat(), m_rect.w, m_rect.h));
base::UniquePtr<Image> resultImage(Image::create(sprite->getPixelFormat(), m_rect.w, m_rect.h));
// Clear the image with mask color.
image_clear(resultImage, 0);
@ -203,7 +203,7 @@ protected:
animation[i] = NULL;
// Create the cel.
UniquePtr<Cel> resultCel(new Cel(FrameNumber(i), indexInStock));
base::UniquePtr<Cel> resultCel(new Cel(FrameNumber(i), indexInStock));
// Add the cel in the layer.
api.addCel(resultLayer, resultCel);
@ -343,11 +343,7 @@ private:
bool m_fileOpened;
};
//////////////////////////////////////////////////////////////////////
// ImportSpriteSheetCommand
class ImportSpriteSheetCommand : public Command
{
class ImportSpriteSheetCommand : public Command {
public:
ImportSpriteSheetCommand();
Command* clone() { return new ImportSpriteSheetCommand(*this); }
@ -365,14 +361,13 @@ ImportSpriteSheetCommand::ImportSpriteSheetCommand()
void ImportSpriteSheetCommand::onExecute(Context* context)
{
UniquePtr<Window> window(new ImportSpriteSheetWindow(context));
base::UniquePtr<Window> window(new ImportSpriteSheetWindow(context));
window->openWindowInForeground();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createImportSpriteSheetCommand()
{
return new ImportSpriteSheetCommand;
}
} // namespace app

View File

@ -16,24 +16,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/context_access.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "context_access.h"
#include "modules/gui.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include "undoers/set_mask.h"
//////////////////////////////////////////////////////////////////////
// invert_mask
namespace app {
class InvertMaskCommand : public Command
{
class InvertMaskCommand : public Command {
public:
InvertMaskCommand();
Command* clone() { return new InvertMaskCommand(*this); }
@ -82,7 +82,7 @@ void InvertMaskCommand::onExecute(Context* context)
undo.pushUndoer(new undoers::SetMask(undo.getObjects(), document));
/* create a new mask */
UniquePtr<Mask> mask(new Mask());
base::UniquePtr<Mask> mask(new Mask());
/* select all the sprite area */
mask->replace(0, 0, sprite->getWidth(), sprite->getHeight());
@ -116,10 +116,9 @@ void InvertMaskCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createInvertMaskCommand()
{
return new InvertMaskCommand;
}
} // namespace app

View File

@ -16,21 +16,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/launcher.h"
#include "app/resource_finder.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
namespace app {
class LaunchCommand : public Command
{
class LaunchCommand : public Command {
public:
LaunchCommand();
Command* clone() const { return new LaunchCommand(*this); }
@ -71,7 +71,7 @@ void LaunchCommand::onExecute(Context* context)
switch (m_type) {
case Url:
Launcher::openUrl(m_path);
launcher::open_url(m_path);
break;
case FileInDocs:
@ -83,7 +83,7 @@ void LaunchCommand::onExecute(Context* context)
if (!exists(path))
continue;
Launcher::openFile(path);
launcher::open_file(path);
break;
}
}
@ -92,10 +92,9 @@ void LaunchCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createLaunchCommand()
{
return new LaunchCommand;
}
} // namespace app

View File

@ -16,22 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "ui/ui.h"
//////////////////////////////////////////////////////////////////////
// layer_from_background
namespace app {
class LayerFromBackgroundCommand : public Command
{
class LayerFromBackgroundCommand : public Command {
public:
LayerFromBackgroundCommand();
Command* clone() { return new LayerFromBackgroundCommand(*this); }
@ -71,10 +71,9 @@ void LayerFromBackgroundCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createLayerFromBackgroundCommand()
{
return new LayerFromBackgroundCommand;
}
} // namespace app

View File

@ -16,25 +16,25 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "base/bind.h"
#include "ui/gui.h"
#include "ui/ui.h"
#include "app.h"
#include "commands/command.h"
#include "context_access.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/modules/gui.h"
#include "raster/image.h"
#include "raster/layer.h"
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// layer_properties
class LayerPropertiesCommand : public Command
{
class LayerPropertiesCommand : public Command {
public:
LayerPropertiesCommand();
Command* clone() { return new LayerPropertiesCommand(*this); }
@ -62,7 +62,7 @@ void LayerPropertiesCommand::onExecute(Context* context)
const ContextReader reader(context);
const Layer* layer = reader.layer();
UniquePtr<Window> window(new Window(false, "Layer Properties"));
base::UniquePtr<Window> window(new Window(false, "Layer Properties"));
Box* box1 = new Box(JI_VERTICAL);
Box* box2 = new Box(JI_HORIZONTAL);
Box* box3 = new Box(JI_HORIZONTAL + JI_HOMOGENEOUS);
@ -99,10 +99,9 @@ void LayerPropertiesCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createLayerPropertiesCommand()
{
return new LayerPropertiesCommand;
}
} // namespace app

View File

@ -16,22 +16,25 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/file_selector.h"
#include "commands/command.h"
#include "commands/params.h"
#include "context_access.h"
#include "modules/gui.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "app/util/msk_file.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/alert.h"
#include "undo_transaction.h"
#include "undoers/set_mask.h"
#include "util/msk_file.h"
class LoadMaskCommand : public Command
{
namespace app {
class LoadMaskCommand : public Command {
std::string m_filename;
public:
@ -77,7 +80,7 @@ void LoadMaskCommand::onExecute(Context* context)
m_filename = filename;
}
UniquePtr<Mask> mask(load_msk_file(m_filename.c_str()));
base::UniquePtr<Mask> mask(load_msk_file(m_filename.c_str()));
if (!mask)
throw base::Exception("Error loading .msk file: %s",
static_cast<const char*>(m_filename.c_str()));
@ -99,10 +102,9 @@ void LoadMaskCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createLoadMaskCommand()
{
return new LoadMaskCommand;
}
} // namespace app

View File

@ -16,21 +16,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include "undoers/set_mask.h"
//////////////////////////////////////////////////////////////////////
// mask_all
namespace app {
class MaskAllCommand : public Command
{
class MaskAllCommand : public Command {
public:
MaskAllCommand();
Command* clone() { return new MaskAllCommand(*this); }
@ -74,10 +74,9 @@ void MaskAllCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createMaskAllCommand()
{
return new MaskAllCommand;
}
} // namespace app

View File

@ -16,17 +16,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context.h"
#include "dialogs/maskcol.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/dialogs/maskcol.h"
//////////////////////////////////////////////////////////////////////
// mask_by_color
namespace app {
class MaskByColorCommand : public Command
{
class MaskByColorCommand : public Command {
public:
MaskByColorCommand();
Command* clone() { return new MaskByColorCommand(*this); }
@ -54,10 +54,9 @@ void MaskByColorCommand::onExecute(Context* context)
dialogs_mask_color(context);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createMaskByColorCommand()
{
return new MaskByColorCommand;
}
} // namespace app

View File

@ -16,33 +16,33 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/add_cel.h"
#include "app/undoers/add_image.h"
#include "app/undoers/remove_layer.h"
#include "app/undoers/replace_image.h"
#include "app/undoers/set_cel_position.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "context_access.h"
#include "document.h"
#include "document_api.h"
#include "modules/gui.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "undoers/add_cel.h"
#include "undoers/add_image.h"
#include "undoers/remove_layer.h"
#include "undoers/replace_image.h"
#include "undoers/set_cel_position.h"
#include "ui/ui.h"
//////////////////////////////////////////////////////////////////////
// merge_down_layer
namespace app {
class MergeDownLayerCommand : public Command
{
class MergeDownLayerCommand : public Command {
public:
MergeDownLayerCommand();
Command* clone() { return new MergeDownLayerCommand(*this); }
@ -87,7 +87,7 @@ void MergeDownLayerCommand::onExecute(Context* context)
Layer* dst_layer = src_layer->getPrevious();
Cel *src_cel, *dst_cel;
Image *src_image;
UniquePtr<Image> dst_image;
base::UniquePtr<Image> dst_image;
int index;
for (FrameNumber frpos(0); frpos<sprite->getTotalFrames(); ++frpos) {
@ -184,10 +184,9 @@ void MergeDownLayerCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createMergeDownLayerCommand()
{
return new MergeDownLayerCommand;
}
} // namespace app

View File

@ -16,16 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "dialogs/aniedit.h"
#include "context_access.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/dialogs/aniedit.h"
#include "app/util/celmove.h"
#include "ui/base.h"
#include "util/celmove.h"
class MoveCelCommand : public Command
{
namespace app {
class MoveCelCommand : public Command {
public:
MoveCelCommand();
Command* clone() const { return new MoveCelCommand(*this); }
@ -53,10 +56,9 @@ void MoveCelCommand::onExecute(Context* context)
move_cel(writer);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createMoveCelCommand()
{
return new MoveCelCommand;
}
} // namespace app

View File

@ -16,42 +16,42 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "app/commands/command.h"
#include "app/console.h"
#include "app/document.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "app/modules/editors.h"
#include "app/modules/palettes.h"
#include "app/ui/color_bar.h"
#include "app/ui/workspace.h"
#include "app/ui_context.h"
#include "app/util/clipboard.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "console.h"
#include "document.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "modules/palettes.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "util/clipboard.h"
#include "widgets/color_bar.h"
#include "widgets/workspace.h"
#include "ui/ui.h"
#include <allegro/config.h>
#include <allegro/unicode.h>
using namespace ui;
//////////////////////////////////////////////////////////////////////
// new_file
namespace app {
class NewFileCommand : public Command
{
class NewFileCommand : public Command {
public:
NewFileCommand();
Command* clone() { return new NewFileCommand(*this); }
@ -86,7 +86,7 @@ void NewFileCommand::onExecute(Context* context)
};
// Load the window widget
UniquePtr<Window> window(app::load_widget<Window>("new_sprite.xml", "new_sprite"));
base::UniquePtr<Window> window(app::load_widget<Window>("new_sprite.xml", "new_sprite"));
Widget* width = app::find_widget<Widget>(window, "width");
Widget* height = app::find_widget<Widget>(window, "height");
Widget* radio1 = app::find_widget<Widget>(window, "radio1");
@ -110,7 +110,7 @@ void NewFileCommand::onExecute(Context* context)
// If the clipboard contains an image, we can show the size of the
// clipboard as default image size.
gfx::Size clipboardSize;
if (util::clipboard::get_image_size(clipboardSize)) {
if (clipboard::get_image_size(clipboardSize)) {
w = clipboardSize.w;
h = clipboardSize.h;
}
@ -168,7 +168,7 @@ void NewFileCommand::onExecute(Context* context)
ASSERT(format == IMAGE_RGB || format == IMAGE_GRAYSCALE || format == IMAGE_INDEXED);
ASSERT(w > 0 && h > 0);
UniquePtr<Document> document(
base::UniquePtr<Document> document(
Document::createBasicDocument(format, w, h,
(format == IMAGE_INDEXED ? ncolors: 256)));
Sprite* sprite(document->getSprite());
@ -199,10 +199,9 @@ void NewFileCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createNewFileCommand()
{
return new NewFileCommand;
}
} // namespace app

View File

@ -16,30 +16,30 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/color.h"
#include "commands/command.h"
#include "console.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/status_bar.h"
#include "ui/ui.h"
#include <stdexcept>
//////////////////////////////////////////////////////////////////////
// new_frame
class NewFrameCommand : public Command
{
namespace app {
class NewFrameCommand : public Command {
public:
NewFrameCommand();
Command* clone() { return new NewFrameCommand(*this); }
@ -84,10 +84,9 @@ void NewFrameCommand::onExecute(Context* context)
(int)sprite->getTotalFrames());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createNewFrameCommand()
{
return new NewFrameCommand;
}
} // namespace app

View File

@ -16,31 +16,31 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "commands/command.h"
#include "commands/params.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/modules/gui.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/status_bar.h"
#include "ui/ui.h"
#include <cstdio>
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// new_layer
class NewLayerCommand : public Command
{
class NewLayerCommand : public Command {
public:
NewLayerCommand();
Command* clone() { return new NewLayerCommand(*this); }
@ -97,7 +97,7 @@ void NewLayerCommand::onExecute(Context* context)
// If params specify to ask the user about the name...
if (m_ask) {
// We open the window to ask the name
UniquePtr<Window> window(app::load_widget<Window>("new_layer.xml", "new_layer"));
base::UniquePtr<Window> window(app::load_widget<Window>("new_layer.xml", "new_layer"));
Widget* name_widget = app::find_widget<Widget>(window, "name");
name_widget->setText(name.c_str());
jwidget_set_min_size(name_widget, 128, 0);
@ -150,10 +150,9 @@ static int get_max_layer_num(Layer* layer)
return max;
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createNewLayerCommand()
{
return new NewLayerCommand;
}
} // namespace app

View File

@ -16,29 +16,29 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/document_api.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/modules/gui.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/status_bar.h"
#include "ui/ui.h"
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// new_layer_set
class NewLayerSetCommand : public Command
{
class NewLayerSetCommand : public Command {
public:
NewLayerSetCommand();
Command* clone() { return new NewLayerSetCommand(*this); }
@ -68,7 +68,7 @@ void NewLayerSetCommand::onExecute(Context* context)
Sprite* sprite(writer.sprite());
// load the window widget
UniquePtr<Window> window(app::load_widget<Window>("new_layer.xml", "new_layer_set"));
base::UniquePtr<Window> window(app::load_widget<Window>("new_layer.xml", "new_layer_set"));
window->openWindowInForeground();
@ -90,10 +90,9 @@ void NewLayerSetCommand::onExecute(Context* context)
StatusBar::instance()->showTip(1000, "Layer `%s' created", name.c_str());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createNewLayerSetCommand()
{
return new NewLayerSetCommand;
}
} // namespace app

View File

@ -16,37 +16,37 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/document.h"
#include "app/file/file.h"
#include "app/file_selector.h"
#include "app/job.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/recent_files.h"
#include "app/ui/status_bar.h"
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/thread.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "commands/params.h"
#include "console.h"
#include "document.h"
#include "file/file.h"
#include "job.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "raster/sprite.h"
#include "recent_files.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "widgets/status_bar.h"
#include "ui/ui.h"
#include <allegro.h>
#include <stdio.h>
static const int kMonitoringPeriod = 100;
//////////////////////////////////////////////////////////////////////
// open_file
namespace app {
class OpenFileCommand : public Command
{
class OpenFileCommand : public Command {
public:
OpenFileCommand();
Command* clone() { return new OpenFileCommand(*this); }
@ -123,7 +123,7 @@ void OpenFileCommand::onExecute(Context* context)
}
if (!m_filename.empty()) {
UniquePtr<FileOp> fop(fop_to_load_document(m_filename.c_str(), FILE_LOAD_SEQUENCE_ASK));
base::UniquePtr<FileOp> fop(fop_to_load_document(m_filename.c_str(), FILE_LOAD_SEQUENCE_ASK));
bool unrecent = false;
if (fop) {
@ -165,10 +165,9 @@ void OpenFileCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createOpenFileCommand()
{
return new OpenFileCommand;
}
} // namespace app

View File

@ -16,17 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/launcher.h"
#include "base/compiler_specific.h"
#include "commands/command.h"
#include "context.h"
#include "context_access.h"
#include "document.h"
#include "launcher.h"
class OpenInFolderCommand : public Command
{
namespace app {
class OpenInFolderCommand : public Command {
public:
OpenInFolderCommand();
Command* clone() { return new OpenInFolderCommand(*this); }
@ -53,13 +56,12 @@ bool OpenInFolderCommand::onEnabled(Context* context)
void OpenInFolderCommand::onExecute(Context* context)
{
Launcher::openFolder(context->getActiveDocument()->getFilename());
launcher::open_folder(context->getActiveDocument()->getFilename());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createOpenInFolderCommand()
{
return new OpenInFolderCommand;
}
} // namespace app

View File

@ -16,17 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/launcher.h"
#include "base/compiler_specific.h"
#include "commands/command.h"
#include "context.h"
#include "context_access.h"
#include "document.h"
#include "launcher.h"
class OpenWithAppCommand : public Command
{
namespace app {
class OpenWithAppCommand : public Command {
public:
OpenWithAppCommand();
Command* clone() { return new OpenWithAppCommand(*this); }
@ -53,13 +56,12 @@ bool OpenWithAppCommand::onEnabled(Context* context)
void OpenWithAppCommand::onExecute(Context* context)
{
Launcher::openFile(context->getActiveDocument()->getFilename());
launcher::open_file(context->getActiveDocument()->getFilename());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createOpenWithAppCommand()
{
return new OpenWithAppCommand;
}
} // namespace app

View File

@ -16,32 +16,33 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "app/modules/editors.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "app/ui/color_button.h"
#include "app/ui/editor/editor.h"
#include "app/util/render.h"
#include "base/bind.h"
#include "commands/command.h"
#include "context.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "raster/image.h"
#include "settings/document_settings.h"
#include "ui/gui.h"
#include "util/render.h"
#include "widgets/color_button.h"
#include "widgets/editor/editor.h"
#include "ui/ui.h"
#include <allegro.h>
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// options
class OptionsCommand : public Command
{
class OptionsCommand : public Command {
public:
OptionsCommand();
Command* clone() { return new OptionsCommand(*this); }
@ -68,7 +69,7 @@ OptionsCommand::OptionsCommand()
void OptionsCommand::onExecute(Context* context)
{
// Load the window widget
UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
base::UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
Widget* draw_click2 = app::find_widget<Widget>(window, "draw_click2");
@ -178,10 +179,9 @@ void OptionsCommand::onResetCheckedBg()
m_checked_bg_color2->setColor(app::Color::fromRgb(192, 192, 192));
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createOptionsCommand()
{
return new OptionsCommand;
}
} // namespace app

View File

@ -16,55 +16,60 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/document_undo.h"
#include "app/file_selector.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/settings/settings.h"
#include "app/settings/settings.h"
#include "app/ui/color_bar.h"
#include "app/ui/color_sliders.h"
#include "app/ui/editor/editor.h"
#include "app/ui/hex_color_entry.h"
#include "app/ui/palette_view.h"
#include "app/ui/skin/skin_slider_property.h"
#include "app/ui/status_bar.h"
#include "app/ui/toolbar.h"
#include "app/ui_context.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_palette_colors.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "commands/command.h"
#include "commands/params.h"
#include "console.h"
#include "context_access.h"
#include "document_undo.h"
#include "gfx/hsv.h"
#include "gfx/rgb.h"
#include "gfx/size.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/quantization.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "skin/skin_slider_property.h"
#include "ui/graphics.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "undo_transaction.h"
#include "undoers/set_palette_colors.h"
#include "widgets/color_bar.h"
#include "widgets/color_sliders.h"
#include "widgets/editor/editor.h"
#include "widgets/hex_color_entry.h"
#include "widgets/palette_view.h"
#include "widgets/status_bar.h"
#include "widgets/toolbar.h"
#include "ui/ui.h"
#include <allegro.h>
#include <stdio.h>
#include <string.h>
#include <vector>
namespace app {
using namespace gfx;
using namespace ui;
class PaletteEntryEditor : public Window
{
class PaletteEntryEditor : public Window {
public:
PaletteEntryEditor();
~PaletteEntryEditor();
@ -139,13 +144,9 @@ private:
std::vector<uint32_t> m_clipboardColors;
};
//////////////////////////////////////////////////////////////////////
// PaletteEditorCommand
static PaletteEntryEditor* g_window = NULL;
class PaletteEditorCommand : public Command
{
class PaletteEditorCommand : public Command {
public:
PaletteEditorCommand();
Command* clone() { return new PaletteEditorCommand(*this); }
@ -869,10 +870,9 @@ void PaletteEntryEditor::onPalChange()
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createPaletteEditorCommand()
{
return new PaletteEditorCommand;
}
} // namespace app

View File

@ -16,19 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/util/clipboard.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "util/clipboard.h"
//////////////////////////////////////////////////////////////////////
// paste
namespace app {
class PasteCommand : public Command
{
class PasteCommand : public Command {
public:
PasteCommand();
Command* clone() { return new PasteCommand(*this); }
@ -48,7 +48,7 @@ PasteCommand::PasteCommand()
bool PasteCommand::onEnabled(Context* context)
{
return
util::clipboard::can_paste() &&
clipboard::can_paste() &&
context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
ContextFlags::ActiveLayerIsReadable |
ContextFlags::ActiveLayerIsWritable |
@ -57,13 +57,12 @@ bool PasteCommand::onEnabled(Context* context)
void PasteCommand::onExecute(Context* context)
{
util::clipboard::paste();
clipboard::paste();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createPasteCommand()
{
return new PasteCommand;
}
} // namespace app

View File

@ -16,29 +16,30 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <allegro.h>
#include "ui/gui.h"
#include "ui/ui.h"
#include "commands/command.h"
#include "context.h"
#include "context_access.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "app/ui/editor/editor.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "settings/document_settings.h"
#include "widgets/editor/editor.h"
//////////////////////////////////////////////////////////////////////
// play_animation
namespace app {
class PlayAnimationCommand : public Command
{
class PlayAnimationCommand : public Command {
public:
PlayAnimationCommand();
Command* clone() { return new PlayAnimationCommand(*this); }
@ -165,10 +166,9 @@ void PlayAnimationCommand::onExecute(Context* context)
ui::jmouse_show();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createPlayAnimationCommand()
{
return new PlayAnimationCommand;
}
} // namespace app

View File

@ -16,38 +16,41 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <allegro.h>
#include "ui/gui.h"
#include "ui/ui.h"
#include "app.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "context.h"
#include "modules/editors.h"
#include "modules/gfx.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/context.h"
#include "app/modules/editors.h"
#include "app/modules/gfx.h"
#include "app/modules/gui.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "app/util/render.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "settings/document_settings.h"
#include "util/render.h"
#include "widgets/editor/editor.h"
#include "widgets/status_bar.h"
using namespace ui;
#define PREVIEW_TILED 1
#define PREVIEW_FIT_ON_SCREEN 2
//////////////////////////////////////////////////////////////////////
// base class
namespace app {
class PreviewCommand : public Command
{
using namespace ui;
using namespace raster;
using namespace filters;
class PreviewCommand : public Command {
public:
PreviewCommand();
Command* clone() { return new PreviewCommand(*this); }
@ -70,10 +73,7 @@ bool PreviewCommand::onEnabled(Context* context)
ContextFlags::HasActiveSprite);
}
/**
* Shows the sprite using the complete screen.
*/
// Shows the sprite using the complete screen.
void PreviewCommand::onExecute(Context* context)
{
Editor* editor = current_editor;
@ -92,7 +92,7 @@ void PreviewCommand::onExecute(Context* context)
int u, v, x, y;
int index_bg_color = -1;
IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(document);
TiledMode tiled = docSettings->getTiledMode();
filters::TiledMode tiled = docSettings->getTiledMode();
// Free mouse
editor->getManager()->freeMouse();
@ -121,8 +121,8 @@ void PreviewCommand::onExecute(Context* context)
bool redraw = true;
// Render the sprite
UniquePtr<Image> render;
UniquePtr<Image> doublebuf(Image::create(IMAGE_RGB, JI_SCREEN_W, JI_SCREEN_H));
base::UniquePtr<Image> render;
base::UniquePtr<Image> doublebuf(Image::create(IMAGE_RGB, JI_SCREEN_W, JI_SCREEN_H));
do {
// Update scroll
@ -245,10 +245,9 @@ void PreviewCommand::onExecute(Context* context)
ui::Manager::getDefault()->invalidate();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createPreviewCommand()
{
return new PreviewCommand;
}
} // namespace app

View File

@ -16,14 +16,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "skin/skin_theme.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/skin/skin_theme.h"
#include "app/ui/status_bar.h"
#include "ui/system.h"
#include "ui/theme.h"
#include "widgets/status_bar.h"
#include <allegro.h>
@ -33,11 +35,9 @@
#include <psapi.h>
#endif
//////////////////////////////////////////////////////////////////////
// refresh
namespace app {
class RefreshCommand : public Command
{
class RefreshCommand : public Command {
public:
RefreshCommand();
Command* clone() { return new RefreshCommand(*this); }
@ -61,7 +61,7 @@ void RefreshCommand::onExecute(Context* context)
// Reload skin
{
SkinTheme* theme = (SkinTheme*)ui::CurrentTheme::get();
skin::SkinTheme* theme = (skin::SkinTheme*)ui::CurrentTheme::get();
theme->reload_skin();
theme->regenerate();
}
@ -84,10 +84,9 @@ void RefreshCommand::onExecute(Context* context)
#endif
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createRefreshCommand()
{
return new RefreshCommand;
}
} // namespace app

View File

@ -16,22 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "raster/cel.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
//////////////////////////////////////////////////////////////////////
// remove_cel
namespace app {
class RemoveCelCommand : public Command
{
class RemoveCelCommand : public Command {
public:
RemoveCelCommand();
Command* clone() { return new RemoveCelCommand(*this); }
@ -70,10 +70,9 @@ void RemoveCelCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createRemoveCelCommand()
{
return new RemoveCelCommand;
}
} // namespace app

View File

@ -16,21 +16,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "ui/ui.h"
//////////////////////////////////////////////////////////////////////
// remove_frame
class RemoveFrameCommand : public Command
{
namespace app {
class RemoveFrameCommand : public Command {
public:
RemoveFrameCommand();
Command* clone() { return new RemoveFrameCommand(*this); }
@ -69,10 +69,9 @@ void RemoveFrameCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createRemoveFrameCommand()
{
return new RemoveFrameCommand;
}
} // namespace app

View File

@ -16,24 +16,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "ui/widget.h"
#include "undo_transaction.h"
#include "widgets/status_bar.h"
//////////////////////////////////////////////////////////////////////
// remove_layer
class RemoveLayerCommand : public Command
{
namespace app {
class RemoveLayerCommand : public Command {
public:
RemoveLayerCommand();
Command* clone() { return new RemoveLayerCommand(*this); }
@ -78,10 +78,9 @@ void RemoveLayerCommand::onExecute(Context* context)
layer_name.c_str());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createRemoveLayerCommand()
{
return new RemoveLayerCommand;
}
} // namespace app

View File

@ -16,21 +16,21 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "context_access.h"
#include "modules/gui.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "undo_transaction.h"
#include "undoers/set_mask.h"
//////////////////////////////////////////////////////////////////////
// reselect_mask
namespace app {
class ReselectMaskCommand : public Command
{
class ReselectMaskCommand : public Command {
public:
ReselectMaskCommand();
Command* clone() { return new ReselectMaskCommand(*this); }
@ -77,10 +77,9 @@ void ReselectMaskCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createReselectMaskCommand()
{
return new ReselectMaskCommand;
}
} // namespace app

View File

@ -16,31 +16,31 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "commands/params.h"
#include "context_access.h"
#include "document_api.h"
#include "job.h"
#include "modules/gui.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/job.h"
#include "app/modules/gui.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "undo_transaction.h"
#include "widgets/color_bar.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
//////////////////////////////////////////////////////////////////////
// rotate_canvas
namespace app {
class RotateCanvasCommand : public Command
{
class RotateCanvasCommand : public Command {
int m_angle;
public:
@ -130,7 +130,7 @@ protected:
// rotate mask
if (m_document->isMaskVisible()) {
Mask* origMask = m_document->getMask();
UniquePtr<Mask> new_mask(new Mask());
base::UniquePtr<Mask> new_mask(new Mask());
const gfx::Rect& origBounds = origMask->getBounds();
int x = 0, y = 0;
@ -205,10 +205,9 @@ void RotateCanvasCommand::onExecute(Context* context)
update_screen_for_document(reader.document());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createRotateCanvasCommand()
{
return new RotateCanvasCommand;
}
} // namespace app

View File

@ -16,30 +16,33 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/file/file.h"
#include "app/file_selector.h"
#include "app/job.h"
#include "app/modules/gui.h"
#include "app/recent_files.h"
#include "app/ui/status_bar.h"
#include "base/bind.h"
#include "base/thread.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "console.h"
#include "context_access.h"
#include "file/file.h"
#include "job.h"
#include "modules/gui.h"
#include "raster/sprite.h"
#include "recent_files.h"
#include "ui/gui.h"
#include "widgets/status_bar.h"
#include "ui/ui.h"
#include <allegro.h>
static const int kMonitoringPeriod = 100;
class SaveFileJob : public Job, public IFileOpProgress
{
namespace app {
class SaveFileJob : public Job, public IFileOpProgress {
public:
SaveFileJob(FileOp* fop, const char* filename)
: Job("Saving file")
@ -74,7 +77,7 @@ private:
static void save_document_in_background(Document* document, bool mark_as_saved)
{
UniquePtr<FileOp> fop(fop_to_save_document(document));
base::UniquePtr<FileOp> fop(fop_to_save_document(document));
if (!fop)
return;
@ -96,7 +99,7 @@ static void save_document_in_background(Document* document, bool mark_as_saved)
}
}
/*********************************************************************/
//////////////////////////////////////////////////////////////////////
static void save_as_dialog(const ContextReader& reader, const char* dlg_title, bool mark_as_saved)
{
@ -149,11 +152,7 @@ static void save_as_dialog(const ContextReader& reader, const char* dlg_title, b
}
}
//////////////////////////////////////////////////////////////////////
// save_file
class SaveFileCommand : public Command
{
class SaveFileCommand : public Command {
public:
SaveFileCommand();
Command* clone() { return new SaveFileCommand(*this); }
@ -201,11 +200,7 @@ void SaveFileCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// save_file_as
class SaveFileAsCommand : public Command
{
class SaveFileAsCommand : public Command {
public:
SaveFileAsCommand();
Command* clone() { return new SaveFileAsCommand(*this); }
@ -233,11 +228,7 @@ void SaveFileAsCommand::onExecute(Context* context)
save_as_dialog(reader, "Save As", true);
}
//////////////////////////////////////////////////////////////////////
// save_file_copy_as
class SaveFileCopyAsCommand : public Command
{
class SaveFileCopyAsCommand : public Command {
public:
SaveFileCopyAsCommand();
Command* clone() { return new SaveFileCopyAsCommand(*this); }
@ -276,9 +267,6 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createSaveFileCommand()
{
return new SaveFileCommand;
@ -293,3 +281,5 @@ Command* CommandFactory::createSaveFileCopyAsCommand()
{
return new SaveFileCopyAsCommand;
}
} // namespace app

View File

@ -16,23 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <allegro/file.h>
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/file_selector.h"
#include "commands/command.h"
#include "context_access.h"
#include "app/util/msk_file.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/alert.h"
#include "util/msk_file.h"
//////////////////////////////////////////////////////////////////////
// save_mask
namespace app {
class SaveMaskCommand : public Command
{
class SaveMaskCommand : public Command {
public:
SaveMaskCommand();
Command* clone() { return new SaveMaskCommand(*this); }
@ -89,10 +89,9 @@ void SaveMaskCommand::onExecute(Context* context)
ui::Alert::show("Error<<Error saving .msk file<<%s||&Close", filename.c_str());
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createSaveMaskCommand()
{
return new SaveMaskCommand;
}
} // namespace app

View File

@ -16,22 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "commands/command.h"
#include "commands/params.h"
#include "context_access.h"
#include "modules/editors.h"
#include "settings/document_settings.h"
#include "settings/settings.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/modules/editors.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "app/ui/editor/editor.h"
#include "ui/view.h"
#include "widgets/editor/editor.h"
//////////////////////////////////////////////////////////////////////
// scroll
namespace app {
class ScrollCommand : public Command
{
class ScrollCommand : public Command {
public:
enum Direction { Left, Up, Right, Down, };
enum Units {
@ -142,10 +142,9 @@ void ScrollCommand::onExecute(Context* context)
current_editor->setEditorScroll(scroll.x+dx, scroll.y+dy, true);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createScrollCommand()
{
return new ScrollCommand;
}
} // namespace app

View File

@ -16,19 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "commands/command.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/main_window.h"
#include "app/ui/workspace.h"
#include "ui/base.h"
#include "widgets/main_window.h"
#include "widgets/workspace.h"
//////////////////////////////////////////////////////////////////////
// make_unique_editor
namespace app {
class MakeUniqueEditorCommand : public Command
{
class MakeUniqueEditorCommand : public Command {
public:
MakeUniqueEditorCommand();
Command* clone() { return new MakeUniqueEditorCommand(*this); }
@ -46,16 +46,12 @@ MakeUniqueEditorCommand::MakeUniqueEditorCommand()
void MakeUniqueEditorCommand::onExecute(Context* context)
{
widgets::Workspace* workspace = App::instance()->getMainWindow()->getWorkspace();
Workspace* workspace = App::instance()->getMainWindow()->getWorkspace();
if (workspace->getActiveView() != NULL)
workspace->makeUnique(workspace->getActiveView());
}
//////////////////////////////////////////////////////////////////////
// split_editor_horizontally
class SplitEditorHorizontallyCommand : public Command
{
class SplitEditorHorizontallyCommand : public Command {
public:
SplitEditorHorizontallyCommand();
Command* clone() { return new SplitEditorHorizontallyCommand(*this); }
@ -73,16 +69,12 @@ SplitEditorHorizontallyCommand::SplitEditorHorizontallyCommand()
void SplitEditorHorizontallyCommand::onExecute(Context* context)
{
widgets::Workspace* workspace = App::instance()->getMainWindow()->getWorkspace();
Workspace* workspace = App::instance()->getMainWindow()->getWorkspace();
if (workspace->getActiveView() != NULL)
workspace->splitView(workspace->getActiveView(), JI_HORIZONTAL);
}
//////////////////////////////////////////////////////////////////////
// split_editor_vertically
class SplitEditorVerticallyCommand : public Command
{
class SplitEditorVerticallyCommand : public Command {
public:
SplitEditorVerticallyCommand();
Command* clone() { return new SplitEditorVerticallyCommand(*this); }
@ -100,14 +92,11 @@ SplitEditorVerticallyCommand::SplitEditorVerticallyCommand()
void SplitEditorVerticallyCommand::onExecute(Context* context)
{
widgets::Workspace* workspace = App::instance()->getMainWindow()->getWorkspace();
Workspace* workspace = App::instance()->getMainWindow()->getWorkspace();
if (workspace->getActiveView() != NULL)
workspace->splitView(workspace->getActiveView(), JI_VERTICAL);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createMakeUniqueEditorCommand()
{
return new MakeUniqueEditorCommand;
@ -122,3 +111,5 @@ Command* CommandFactory::createSplitEditorVerticallyCommand()
{
return new SplitEditorVerticallyCommand;
}
} // namespace app

View File

@ -16,32 +16,32 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/color.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "app/modules/gui.h"
#include "app/ui/color_button.h"
#include "base/bind.h"
#include "base/mem_utils.h"
#include "commands/command.h"
#include "context_access.h"
#include "modules/gui.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "widgets/color_button.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
#include <cstdio>
namespace app {
using namespace ui;
//////////////////////////////////////////////////////////////////////
// sprite_properties
class SpritePropertiesCommand : public Command
{
class SpritePropertiesCommand : public Command {
public:
SpritePropertiesCommand();
Command* clone() { return new SpritePropertiesCommand(*this); }
@ -72,7 +72,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
ColorButton* color_button = NULL;
// Load the window widget
UniquePtr<Window> window(app::load_widget<Window>("sprite_properties.xml", "sprite_properties"));
base::UniquePtr<Window> window(app::load_widget<Window>("sprite_properties.xml", "sprite_properties"));
name = app::find_widget<Widget>(window, "name");
type = app::find_widget<Widget>(window, "type");
size = app::find_widget<Widget>(window, "size");
@ -114,7 +114,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
usprintf(buf, "%dx%d (%s)",
sprite->getWidth(),
sprite->getHeight(),
get_pretty_memory_size(sprite->getMemSize()).c_str());
base::get_pretty_memory_size(sprite->getMemSize()).c_str());
size->setText(buf);
@ -158,10 +158,9 @@ void SpritePropertiesCommand::onExecute(Context* context)
save_window_pos(window, "SpriteProperties");
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createSpritePropertiesCommand()
{
return new SpritePropertiesCommand;
}
} // namespace app

View File

@ -16,36 +16,39 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/job.h"
#include "app/load_widget.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/ui_context.h"
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_api.h"
#include "ini_file.h"
#include "job.h"
#include "modules/gui.h"
#include "modules/palettes.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "ui/gui.h"
#include "ui_context.h"
#include "undo_transaction.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
using namespace ui;
#define PERC_FORMAT "%.1f"
class SpriteSizeJob : public Job
{
namespace app {
using namespace ui;
class SpriteSizeJob : public Job {
ContextWriter m_writer;
Document* m_document;
Sprite* m_sprite;
@ -118,14 +121,14 @@ protected:
// Resize mask
if (m_document->isMaskVisible()) {
UniquePtr<Image> old_bitmap
base::UniquePtr<Image> old_bitmap
(image_crop(m_document->getMask()->getBitmap(), -1, -1,
m_document->getMask()->getBitmap()->w+2,
m_document->getMask()->getBitmap()->h+2, 0));
int w = scale_x(old_bitmap->w);
int h = scale_y(old_bitmap->h);
UniquePtr<Mask> new_mask(new Mask);
base::UniquePtr<Mask> new_mask(new Mask);
new_mask->replace(scale_x(m_document->getMask()->getBounds().x-1),
scale_y(m_document->getMask()->getBounds().y-1), MAX(1, w), MAX(1, h));
image_resize(old_bitmap, new_mask->getBitmap(),
@ -154,12 +157,7 @@ protected:
};
//////////////////////////////////////////////////////////////////////
// SpriteSize
class SpriteSizeCommand : public Command
{
class SpriteSizeCommand : public Command {
public:
SpriteSizeCommand();
Command* clone() { return new SpriteSizeCommand(*this); }
@ -201,7 +199,7 @@ void SpriteSizeCommand::onExecute(Context* context)
const Sprite* sprite(reader.sprite());
// load the window widget
UniquePtr<Window> window(app::load_widget<Window>("sprite_size.xml", "sprite_size"));
base::UniquePtr<Window> window(app::load_widget<Window>("sprite_size.xml", "sprite_size"));
m_widthPx = app::find_widget<Entry>(window, "width_px");
m_heightPx = app::find_widget<Entry>(window, "height_px");
m_widthPerc = app::find_widget<Entry>(window, "width_perc");
@ -314,10 +312,9 @@ void SpriteSizeCommand::onHeightPercChange()
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createSpriteSizeCommand()
{
return new SpriteSizeCommand;
}
} // namespace app

View File

@ -16,17 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <allegro/unicode.h>
#include "app.h"
#include "commands/command.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/color_bar.h"
#include "ui/base.h"
#include "widgets/color_bar.h"
class SwitchColorsCommand : public Command
{
namespace app {
class SwitchColorsCommand : public Command {
public:
SwitchColorsCommand();
@ -51,10 +54,9 @@ void SwitchColorsCommand::onExecute(Context* context)
colorbar->setBgColor(fg);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createSwitchColorsCommand()
{
return new SwitchColorsCommand;
}
} // namespace app

View File

@ -16,23 +16,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_undo.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "base/thread.h"
#include "commands/command.h"
#include "context_access.h"
#include "document_undo.h"
#include "ini_file.h"
#include "modules/editors.h"
#include "modules/gui.h"
#include "raster/sprite.h"
#include "ui/system.h"
#include "widgets/editor/editor.h"
#include "widgets/status_bar.h"
class UndoCommand : public Command
{
namespace app {
class UndoCommand : public Command {
public:
enum Type { Undo, Redo };
@ -116,9 +119,6 @@ void UndoCommand::onExecute(Context* context)
update_screen_for_document(document);
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createUndoCommand()
{
return new UndoCommand(UndoCommand::Undo);
@ -128,3 +128,5 @@ Command* CommandFactory::createRedoCommand()
{
return new UndoCommand(UndoCommand::Redo);
}
} // namespace app

View File

@ -16,11 +16,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "console.h"
#include "commands/command.h"
#include "commands/params.h"
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/console.h"
namespace app {
Command::Command(const char* short_name, const char* friendly_name, CommandFlags flags)
{
@ -96,3 +100,5 @@ void Command::onExecute(Context* context)
{
// Do nothing
}
} // namespace app

View File

@ -0,0 +1,62 @@
/* ASEPRITE
* Copyright (C) 2001-2013 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 APP_COMMANDS_COMMAND_H_INCLUDED
#define APP_COMMANDS_COMMAND_H_INCLUDED
#include "app/commands/command_factory.h"
namespace app {
class Context;
class Params;
enum CommandFlags {
CmdUIOnlyFlag = 0x00000001,
CmdRecordableFlag = 0x00000002,
};
class Command {
const char* m_short_name;
const char* m_friendly_name;
CommandFlags m_flags;
public:
Command(const char* short_name, const char* friendly_name, CommandFlags flags);
virtual ~Command();
virtual Command* clone() const { return new Command(*this); }
const char* short_name() const { return m_short_name; }
const char* friendly_name() const { return m_friendly_name; }
void loadParams(Params* params);
bool isEnabled(Context* context);
bool isChecked(Context* context);
void execute(Context* context);
protected:
virtual void onLoadParams(Params* params);
virtual bool onEnabled(Context* context);
virtual bool onChecked(Context* context);
virtual void onExecute(Context* context);
};
} // namespace app
#endif

View File

@ -16,20 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMANDS_COMMAND_FACTORY_H_INCLUDED
#define COMMANDS_COMMAND_FACTORY_H_INCLUDED
#ifndef APP_COMMANDS_COMMAND_FACTORY_H_INCLUDED
#define APP_COMMANDS_COMMAND_FACTORY_H_INCLUDED
class Command;
namespace app {
class Command;
class CommandFactory
{
public:
#undef FOR_EACH_COMMAND
#define FOR_EACH_COMMAND(Name) \
class CommandFactory {
public:
#undef FOR_EACH_COMMAND
#define FOR_EACH_COMMAND(Name) \
static Command* create##Name##Command();
#include "commands/commands_list.h"
#undef FOR_EACH_COMMAND
};
#include "app/commands/commands_list.h"
#undef FOR_EACH_COMMAND
};
} // namespace app
#endif

View File

@ -16,23 +16,27 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* #include <stdio.h> */
#include <allegro/unicode.h>
#include <exception>
#include <string.h>
#include "ui/gui.h"
#include "ui/ui.h"
#include "commands/command.h"
#include "commands/commands.h"
#include "console.h"
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/console.h"
namespace app {
#undef FOR_EACH_COMMAND
#define FOR_EACH_COMMAND(Name) \
const char* CommandId::Name = #Name;
#include "commands/commands_list.h"
#include "app/commands/commands_list.h"
#undef FOR_EACH_COMMAND
CommandsModule* CommandsModule::m_instance = NULL;
@ -46,7 +50,7 @@ CommandsModule::CommandsModule()
#define FOR_EACH_COMMAND(Name) \
m_commands.push_back(CommandFactory::create##Name##Command());
#include "commands/commands_list.h"
#include "app/commands/commands_list.h"
#undef FOR_EACH_COMMAND
}
@ -82,3 +86,5 @@ Command* CommandsModule::getCommandByName(const char* name)
return NULL;
}
} // namespace app

View File

@ -16,38 +16,39 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMANDS_COMMANDS_H_INCLUDED
#define COMMANDS_COMMANDS_H_INCLUDED
#ifndef APP_COMMANDS_COMMANDS_H_INCLUDED
#define APP_COMMANDS_COMMANDS_H_INCLUDED
#include "ui/base.h"
struct CommandId
{
#undef FOR_EACH_COMMAND
#define FOR_EACH_COMMAND(Name) \
static const char* Name;
#include "commands/commands_list.h"
#undef FOR_EACH_COMMAND
};
#include <vector>
class Command;
namespace app {
typedef std::vector<Command*> CommandsList;
struct CommandId {
#undef FOR_EACH_COMMAND
#define FOR_EACH_COMMAND(Name) \
static const char* Name;
#include "app/commands/commands_list.h"
#undef FOR_EACH_COMMAND
};
class CommandsModule
{
static CommandsModule* m_instance;
CommandsList m_commands;
class Command;
typedef std::vector<Command*> CommandsList;
public:
CommandsModule();
~CommandsModule();
class CommandsModule {
static CommandsModule* m_instance;
CommandsList m_commands;
static CommandsModule* instance();
public:
CommandsModule();
~CommandsModule();
Command* getCommandByName(const char* name);
};
static CommandsModule* instance();
Command* getCommandByName(const char* name);
};
} // namespace app
#endif

View File

@ -16,24 +16,30 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app.h"
#include "app/app.h"
#include "app/color.h"
#include "app/commands/command.h"
#include "app/commands/filters/color_curve_editor.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "app/commands/filters/filter_window.h"
#include "app/context.h"
#include "app/ini_file.h"
#include "app/modules/gui.h"
#include "app/ui/color_button.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/filters/color_curve_editor.h"
#include "commands/filters/filter_manager_impl.h"
#include "commands/filters/filter_window.h"
#include "context.h"
#include "filters/color_curve.h"
#include "filters/color_curve_filter.h"
#include "ini_file.h"
#include "modules/gui.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "widgets/color_button.h"
#include "ui/ui.h"
namespace app {
using namespace filters;
static ColorCurve* the_curve = NULL;
@ -43,11 +49,7 @@ static void on_exit_delete_curve()
delete the_curve;
}
//////////////////////////////////////////////////////////////////////
// Color Curve window
class ColorCurveWindow : public FilterWindow
{
class ColorCurveWindow : public FilterWindow {
public:
ColorCurveWindow(ColorCurveFilter& filter, FilterManagerImpl& filterMgr)
: FilterWindow("Color Curve", "ColorCurve", &filterMgr,
@ -84,11 +86,7 @@ private:
ColorCurveEditor m_editor;
};
//////////////////////////////////////////////////////////////////////
// Color Curve command
class ColorCurveCommand : public Command
{
class ColorCurveCommand : public Command {
public:
ColorCurveCommand();
Command* clone() const { return new ColorCurveCommand(*this); }
@ -140,10 +138,9 @@ void ColorCurveCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createColorCurveCommand()
{
return new ColorCurveCommand;
}
} // namespace app

View File

@ -16,23 +16,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/color.h"
#include "app/commands/command.h"
#include "app/commands/filters/convolution_matrix_stock.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "app/commands/filters/filter_window.h"
#include "app/context.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/filters/convolution_matrix_stock.h"
#include "commands/filters/filter_manager_impl.h"
#include "commands/filters/filter_window.h"
#include "context.h"
#include "filters/convolution_matrix.h"
#include "filters/convolution_matrix_filter.h"
#include "ini_file.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "settings/document_settings.h"
#include "ui/button.h"
#include "ui/label.h"
#include "ui/listbox.h"
@ -44,15 +47,14 @@
#include <string.h>
namespace app {
using namespace filters;
using namespace ui;
static const char* ConfigSection = "ConvolutionMatrix";
using namespace ui;
//////////////////////////////////////////////////////////////////////
// Convolution Matrix window
class ConvolutionMatrixWindow : public FilterWindow
{
class ConvolutionMatrixWindow : public FilterWindow {
public:
ConvolutionMatrixWindow(ConvolutionMatrixFilter& filter, FilterManagerImpl& filterMgr, ConvolutionMatrixStock& stock)
: FilterWindow("Convolution Matrix", ConfigSection, &filterMgr,
@ -144,18 +146,14 @@ private:
}
ConvolutionMatrixFilter& m_filter;
UniquePtr<Widget> m_controlsWidget;
base::UniquePtr<Widget> m_controlsWidget;
ConvolutionMatrixStock& m_stock;
View* m_view;
ListBox* m_stockListBox;
Button* m_reloadButton;
};
//////////////////////////////////////////////////////////////////////
// Convolution Matrix command
class ConvolutionMatrixCommand : public Command
{
class ConvolutionMatrixCommand : public Command {
public:
ConvolutionMatrixCommand();
Command* clone() const { return new ConvolutionMatrixCommand(*this); }
@ -203,10 +201,9 @@ void ConvolutionMatrixCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createConvolutionMatrixCommand()
{
return new ConvolutionMatrixCommand;
}
} // namespace app

View File

@ -16,21 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "app/commands/filters/filter_window.h"
#include "app/context.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "app/settings/document_settings.h"
#include "app/settings/settings.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/filters/filter_manager_impl.h"
#include "commands/filters/filter_window.h"
#include "context.h"
#include "filters/median_filter.h"
#include "ini_file.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "settings/document_settings.h"
#include "settings/settings.h"
#include "ui/button.h"
#include "ui/entry.h"
#include "ui/grid.h"
@ -39,13 +41,13 @@
#include <stdio.h>
namespace app {
using namespace filters;
static const char* ConfigSection = "Despeckle";
//////////////////////////////////////////////////////////////////////
// Despeckle window
class DespeckleWindow : public FilterWindow
{
class DespeckleWindow : public FilterWindow {
public:
DespeckleWindow(MedianFilter& filter, FilterManagerImpl& filterMgr)
: FilterWindow("Median Blur", ConfigSection, &filterMgr,
@ -80,7 +82,7 @@ private:
}
MedianFilter& m_filter;
UniquePtr<ui::Widget> m_controlsWidget;
base::UniquePtr<ui::Widget> m_controlsWidget;
ui::Entry* m_widthEntry;
ui::Entry* m_heightEntry;
};
@ -134,10 +136,9 @@ void DespeckleCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createDespeckleCommand()
{
return new DespeckleCommand;
}
} // namespace app

View File

@ -16,17 +16,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/color.h"
#include "app/ui/color_button.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/filters/filter_manager_impl.h"
#include "commands/filters/filter_window.h"
#include "context.h"
#include "app/commands/command.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "app/commands/filters/filter_window.h"
#include "app/context.h"
#include "filters/invert_color_filter.h"
#include "ini_file.h"
#include "modules/gui.h"
#include "app/ini_file.h"
#include "app/modules/gui.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
@ -35,15 +38,12 @@
#include "ui/slider.h"
#include "ui/widget.h"
#include "ui/window.h"
#include "widgets/color_button.h"
namespace app {
static const char* ConfigSection = "InvertColor";
//////////////////////////////////////////////////////////////////////
// Invert Color window
class InvertColorWindow : public FilterWindow
{
class InvertColorWindow : public FilterWindow {
public:
InvertColorWindow(InvertColorFilter& filter, FilterManagerImpl& filterMgr)
: FilterWindow("Invert Color", ConfigSection, &filterMgr,
@ -57,11 +57,7 @@ private:
InvertColorFilter& m_filter;
};
//////////////////////////////////////////////////////////////////////
// Invert Color command
class InvertColorCommand : public Command
{
class InvertColorCommand : public Command {
public:
InvertColorCommand();
Command* clone() const { return new InvertColorCommand(*this); }
@ -97,10 +93,9 @@ void InvertColorCommand::onExecute(Context* context)
window.doModal();
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createInvertColorCommand()
{
return new InvertColorCommand;
}
} // namespace app

View File

@ -16,36 +16,37 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include "app.h"
#include "app/app.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "app/commands/command.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "app/commands/filters/filter_window.h"
#include "app/context.h"
#include "app/find_widget.h"
#include "app/ini_file.h"
#include "app/load_widget.h"
#include "app/ui/color_bar.h"
#include "app/ui/color_button.h"
#include "base/bind.h"
#include "commands/command.h"
#include "commands/filters/filter_manager_impl.h"
#include "commands/filters/filter_window.h"
#include "context.h"
#include "filters/replace_color_filter.h"
#include "ini_file.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/gui.h"
#include "widgets/color_bar.h"
#include "widgets/color_button.h"
#include "ui/ui.h"
namespace app {
static const char* ConfigSection = "ReplaceColor";
//////////////////////////////////////////////////////////////////////
// Wrapper for ReplaceColorFilter to handle colors in an easy way
class ReplaceColorFilterWrapper : public ReplaceColorFilter
{
class ReplaceColorFilterWrapper : public ReplaceColorFilter {
public:
ReplaceColorFilterWrapper(Layer* layer) : m_layer(layer) { }
@ -67,11 +68,7 @@ private:
app::Color m_to;
};
//////////////////////////////////////////////////////////////////////
// Replace Color window
class ReplaceColorWindow : public FilterWindow
{
class ReplaceColorWindow : public FilterWindow {
public:
ReplaceColorWindow(ReplaceColorFilterWrapper& filter, FilterManagerImpl& filterMgr)
: FilterWindow("Replace Color", ConfigSection, &filterMgr,
@ -115,17 +112,13 @@ protected:
private:
ReplaceColorFilterWrapper& m_filter;
UniquePtr<ui::Widget> m_controlsWidget;
base::UniquePtr<ui::Widget> m_controlsWidget;
ColorButton* m_fromButton;
ColorButton* m_toButton;
ui::Slider* m_toleranceSlider;
};
//////////////////////////////////////////////////////////////////////
// Replace Color command
class ReplaceColorCommand : public Command
{
class ReplaceColorCommand : public Command {
public:
ReplaceColorCommand();
Command* clone() const { return new ReplaceColorCommand(*this); }
@ -172,10 +165,9 @@ void ReplaceColorCommand::onExecute(Context* context)
}
}
//////////////////////////////////////////////////////////////////////
// CommandFactory
Command* CommandFactory::createReplaceColorCommand()
{
return new ReplaceColorCommand;
}
} // namespace app

View File

@ -16,11 +16,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "commands/filters/color_curve_editor.h"
#include "app/commands/filters/color_curve_editor.h"
#include "filters/color_curve.h"
#include "ui/alert.h"
#include "ui/entry.h"
@ -65,6 +67,11 @@
* ((ypos) - m_y1) \
/ (m_y2 - m_y1 + 1)))
namespace app {
using namespace ui;
using namespace filters;
enum {
STATUS_STANDBY,
STATUS_MOVING_POINT,
@ -72,8 +79,6 @@ enum {
STATUS_SCALING,
};
using namespace ui;
ColorCurveEditor::ColorCurveEditor(ColorCurve* curve, int x1, int y1, int x2, int y2)
: Widget(kGenericWidget)
, m_curve(curve)
@ -351,7 +356,7 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point)
gfx::Point point_copy = point;
int res;
UniquePtr<Window> window(app::load_widget<Window>("color_curve.xml", "point_properties"));
base::UniquePtr<Window> window(app::load_widget<Window>("color_curve.xml", "point_properties"));
entry_x = window->findChild("x");
entry_y = window->findChild("y");
@ -374,3 +379,5 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point)
return res;
}
} // namespace app

Some files were not shown because too many files have changed in this diff Show More