mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-24 09:02:31 +00:00
Modified some comments to C++ style.
This commit is contained in:
parent
7cdf9d6fe5
commit
a8831eed86
20
src/app.cpp
20
src/app.cpp
@ -109,10 +109,8 @@ static char *palette_filename = NULL;
|
|||||||
|
|
||||||
static void tabsbar_select_callback(Widget* tabs, void *data, int button);
|
static void tabsbar_select_callback(Widget* tabs, void *data, int button);
|
||||||
|
|
||||||
/**
|
// Initializes the application loading the modules, setting the
|
||||||
* Initializes the application loading the modules, setting the
|
// graphics mode, loading the configuration and resources, etc.
|
||||||
* graphics mode, loading the configuration and resources, etc.
|
|
||||||
*/
|
|
||||||
App::App(int argc, char* argv[])
|
App::App(int argc, char* argv[])
|
||||||
: m_modules(NULL)
|
: m_modules(NULL)
|
||||||
, m_legacy(NULL)
|
, m_legacy(NULL)
|
||||||
@ -146,10 +144,8 @@ App::App(int argc, char* argv[])
|
|||||||
set_current_palette(NULL, true);
|
set_current_palette(NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Runs the ASE application. In GUI mode it's the top-level window, in
|
||||||
* Runs the ASE application. In GUI mode it's the top-level window, in
|
// console/scripting it just runs the specified scripts.
|
||||||
* console/scripting it just runs the specified scripts.
|
|
||||||
*/
|
|
||||||
int App::run()
|
int App::run()
|
||||||
{
|
{
|
||||||
/* initialize GUI interface */
|
/* initialize GUI interface */
|
||||||
@ -309,15 +305,13 @@ int App::run()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Finishes the ASE application.
|
||||||
* Finishes the ASE application.
|
|
||||||
*/
|
|
||||||
App::~App()
|
App::~App()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
assert(m_instance == this);
|
assert(m_instance == this);
|
||||||
|
|
||||||
// remove ase handlers
|
// Remove ASE handlers
|
||||||
PRINTF("ASE: Uninstalling\n");
|
PRINTF("ASE: Uninstalling\n");
|
||||||
|
|
||||||
App::trigger_event(AppEvent::Exit);
|
App::trigger_event(AppEvent::Exit);
|
||||||
@ -335,7 +329,7 @@ App::~App()
|
|||||||
m_apphooks[c].clear();
|
m_apphooks[c].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// finalize modules, configuration and core
|
// Finalize modules, configuration and core
|
||||||
Editor::editor_cursor_exit();
|
Editor::editor_cursor_exit();
|
||||||
boundary_exit();
|
boundary_exit();
|
||||||
|
|
||||||
|
@ -189,12 +189,12 @@ void ConfigureTools::execute(Context* context)
|
|||||||
if (get_onionskin()) jwidget_select(check_onionskin);
|
if (get_onionskin()) jwidget_select(check_onionskin);
|
||||||
|
|
||||||
if (first_time) {
|
if (first_time) {
|
||||||
/* append children */
|
// Append children
|
||||||
jwidget_add_child(cursor_color_box, cursor_color);
|
jwidget_add_child(cursor_color_box, cursor_color);
|
||||||
jwidget_add_child(brush_preview_box, brush_preview);
|
jwidget_add_child(brush_preview_box, brush_preview);
|
||||||
jwidget_add_child(brush_type_box, brush_type);
|
jwidget_add_child(brush_type_box, brush_type);
|
||||||
|
|
||||||
/* append hooks */
|
// Append hooks
|
||||||
HOOK(window, JI_SIGNAL_WINDOW_CLOSE, window_close_hook, 0);
|
HOOK(window, JI_SIGNAL_WINDOW_CLOSE, window_close_hook, 0);
|
||||||
HOOK(filled, JI_SIGNAL_CHECK_CHANGE, filled_check_change_hook, 0);
|
HOOK(filled, JI_SIGNAL_CHECK_CHANGE, filled_check_change_hook, 0);
|
||||||
HOOK(tiled, JI_SIGNAL_CHECK_CHANGE, tiled_check_change_hook, 0);
|
HOOK(tiled, JI_SIGNAL_CHECK_CHANGE, tiled_check_change_hook, 0);
|
||||||
@ -215,11 +215,11 @@ void ConfigureTools::execute(Context* context)
|
|||||||
App::instance()->add_hook(AppEvent::Exit, new FreeWidget(window));
|
App::instance()->add_hook(AppEvent::Exit, new FreeWidget(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default position */
|
// Default position
|
||||||
window->remap_window();
|
window->remap_window();
|
||||||
window->center_window();
|
window->center_window();
|
||||||
|
|
||||||
/* load window configuration */
|
// Load window configuration
|
||||||
load_window_pos(window, "ConfigureTool");
|
load_window_pos(window, "ConfigureTool");
|
||||||
|
|
||||||
window->open_window_bg();
|
window->open_window_bg();
|
||||||
|
@ -81,7 +81,7 @@ void PlayAnimationCommand::execute(Context* context)
|
|||||||
if (sprite->frames < 2)
|
if (sprite->frames < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* desactivate the onion-skin */
|
// desactivate the onionskin
|
||||||
set_onionskin(false);
|
set_onionskin(false);
|
||||||
|
|
||||||
jmouse_hide();
|
jmouse_hide();
|
||||||
|
@ -38,14 +38,10 @@ public:
|
|||||||
|
|
||||||
class Context
|
class Context
|
||||||
{
|
{
|
||||||
/**
|
// List of all sprites.
|
||||||
* List of all sprites.
|
|
||||||
*/
|
|
||||||
SpriteList m_sprites;
|
SpriteList m_sprites;
|
||||||
|
|
||||||
/**
|
// Current selected sprite to operate.
|
||||||
* Current selected sprite to operate.
|
|
||||||
*/
|
|
||||||
Sprite* m_current_sprite;
|
Sprite* m_current_sprite;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -128,9 +128,7 @@ void CheckArgs::clear()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Shows the available options for the program
|
||||||
* Shows the available options for the program
|
|
||||||
*/
|
|
||||||
void CheckArgs::usage(bool show_help)
|
void CheckArgs::usage(bool show_help)
|
||||||
{
|
{
|
||||||
Console console;
|
Console console;
|
||||||
|
@ -370,7 +370,7 @@ bool jmanager_generate_messages(JWidget manager)
|
|||||||
jmanager_enqueue_message(msg);
|
jmanager_enqueue_message(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mouse clicks */
|
// mouse clicks
|
||||||
if ((jmouse_b(0) != jmouse_b(1)) &&
|
if ((jmouse_b(0) != jmouse_b(1)) &&
|
||||||
((!jmouse_b(0)) || (!jmouse_b(1)))) {
|
((!jmouse_b(0)) || (!jmouse_b(1)))) {
|
||||||
int current_ticks = ji_clock;
|
int current_ticks = ji_clock;
|
||||||
|
@ -560,14 +560,13 @@ void reload_default_font()
|
|||||||
DIRS *dirs, *dir;
|
DIRS *dirs, *dir;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
/* no font for now */
|
// No font for now
|
||||||
|
|
||||||
if (theme->default_font && theme->default_font != font)
|
if (theme->default_font && theme->default_font != font)
|
||||||
destroy_font(theme->default_font);
|
destroy_font(theme->default_font);
|
||||||
|
|
||||||
theme->default_font = NULL;
|
theme->default_font = NULL;
|
||||||
|
|
||||||
/* directories */
|
// Directories
|
||||||
dirs = dirs_new();
|
dirs = dirs_new();
|
||||||
|
|
||||||
user_font = get_config_string("Options", "UserFont", "");
|
user_font = get_config_string("Options", "UserFont", "");
|
||||||
@ -577,7 +576,7 @@ void reload_default_font()
|
|||||||
usprintf(buf, "fonts/ase%d.pcx", guiscale());
|
usprintf(buf, "fonts/ase%d.pcx", guiscale());
|
||||||
dirs_cat_dirs(dirs, filename_in_datadir(buf));
|
dirs_cat_dirs(dirs, filename_in_datadir(buf));
|
||||||
|
|
||||||
/* try to load the font */
|
// Try to load the font
|
||||||
for (dir=dirs; dir; dir=dir->next) {
|
for (dir=dirs; dir; dir=dir->next) {
|
||||||
theme->default_font = ji_font_load(dir->path);
|
theme->default_font = ji_font_load(dir->path);
|
||||||
if (theme->default_font) {
|
if (theme->default_font) {
|
||||||
@ -589,12 +588,11 @@ void reload_default_font()
|
|||||||
|
|
||||||
dirs_free(dirs);
|
dirs_free(dirs);
|
||||||
|
|
||||||
/* default font: the Allegro one */
|
// default font: the Allegro one
|
||||||
|
|
||||||
if (!theme->default_font)
|
if (!theme->default_font)
|
||||||
theme->default_font = font;
|
theme->default_font = font;
|
||||||
|
|
||||||
/* set all widgets fonts */
|
// Set all widgets fonts
|
||||||
_ji_set_font_of_all_widgets(theme->default_font);
|
_ji_set_font_of_all_widgets(theme->default_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1005,9 +1003,7 @@ void* get_monitor_data(Monitor* monitor)
|
|||||||
return monitor->data;
|
return monitor->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Manager event handler.
|
||||||
* Manager event handler.
|
|
||||||
*/
|
|
||||||
static bool manager_msg_proc(JWidget widget, JMessage msg)
|
static bool manager_msg_proc(JWidget widget, JMessage msg)
|
||||||
{
|
{
|
||||||
switch (msg->type) {
|
switch (msg->type) {
|
||||||
@ -1126,10 +1122,10 @@ void RegenIcons::on_event()
|
|||||||
JWidget button;
|
JWidget button;
|
||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
/* regenerate the theme */
|
// Regenerate the theme
|
||||||
ji_regen_theme();
|
ji_regen_theme();
|
||||||
|
|
||||||
/* fixup the icons */
|
// Fixup the icons
|
||||||
JI_LIST_FOR_EACH(icon_buttons, link) {
|
JI_LIST_FOR_EACH(icon_buttons, link) {
|
||||||
button = reinterpret_cast<JWidget>(link->data);
|
button = reinterpret_cast<JWidget>(link->data);
|
||||||
ji_generic_button_set_icon(button, get_gfx((size_t)button->user_data[3]));
|
ji_generic_button_set_icon(button, get_gfx((size_t)button->user_data[3]));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See readme.txt for copyright information.
|
* See readme.txt for copyright information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Adapted to ASE by David A. Capello */
|
// Adapted to ASE by David Capello
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ Sprite::~Sprite()
|
|||||||
jlist_free(this->palettes);
|
jlist_free(this->palettes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy undo, mask, all layers, stock, boundaries */
|
// destroy undo, mask, etc.
|
||||||
if (this->frlens) jfree(this->frlens);
|
if (this->frlens) jfree(this->frlens);
|
||||||
if (this->undo) undo_free(this->undo);
|
if (this->undo) undo_free(this->undo);
|
||||||
if (this->mask) mask_free(this->mask);
|
if (this->mask) mask_free(this->mask);
|
||||||
|
@ -44,31 +44,28 @@ class Sprite : public GfxObj
|
|||||||
friend Sprite* sprite_new_copy(const Sprite* src_sprite);
|
friend Sprite* sprite_new_copy(const Sprite* src_sprite);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char filename[512]; /* sprite's file name */
|
char filename[512]; // sprite's file name
|
||||||
bool associated_to_file; /* true if this sprite is associated
|
bool associated_to_file; // true if this sprite is associated to a file in the file-system
|
||||||
to a file in the file-system */
|
int imgtype; // image type
|
||||||
int imgtype; /* image type */
|
int w, h; // image width/height size (in pixels)
|
||||||
int w, h; /* image width/height size (in pixels) */
|
int frames; // how many frames has this sprite
|
||||||
int frames; /* how many frames has this sprite */
|
int* frlens; // duration per frame
|
||||||
int *frlens; /* duration per frame */
|
int frame; // current frame, range [0,frames)
|
||||||
int frame; /* current frame, range [0,frames) */
|
JList palettes; // list of palettes
|
||||||
JList palettes; /* list of palettes */
|
Stock *stock; // stock to get images
|
||||||
Stock *stock; /* stock to get images */
|
|
||||||
private:
|
private:
|
||||||
LayerFolder *m_folder; /* main folder of layers */
|
LayerFolder* m_folder; // main folder of layers
|
||||||
public:
|
public:
|
||||||
Layer *layer; /* current layer */
|
Layer* layer; // current layer
|
||||||
Path *path; /* working path */
|
Path* path; // working path
|
||||||
Mask *mask; /* selected mask region */
|
Mask* mask; // selected mask region
|
||||||
Undo *undo; /* undo stack */
|
Undo* undo; // undo stack
|
||||||
struct {
|
struct {
|
||||||
JList paths; /* paths */
|
JList paths; // paths
|
||||||
JList masks; /* masks */
|
JList masks; // masks
|
||||||
} repository;
|
} repository;
|
||||||
|
|
||||||
/**
|
// Selected mask region boundaries
|
||||||
* Selected mask region boundaries
|
|
||||||
*/
|
|
||||||
struct {
|
struct {
|
||||||
int nseg;
|
int nseg;
|
||||||
struct _BoundSeg *seg;
|
struct _BoundSeg *seg;
|
||||||
@ -81,26 +78,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
// Mutex to modify the 'locked' flag.
|
||||||
* Mutex to modify the 'locked' flag.
|
|
||||||
*/
|
|
||||||
JMutex m_mutex;
|
JMutex m_mutex;
|
||||||
|
|
||||||
/**
|
// True if some thread is writing the sprite.
|
||||||
* True if some thread is writing the sprite.
|
|
||||||
*/
|
|
||||||
bool m_write_lock;
|
bool m_write_lock;
|
||||||
|
|
||||||
/**
|
// Greater than zero when one or more threads are reading the sprite.
|
||||||
* Greater than zero when one or more threads are reading the sprite.
|
|
||||||
*/
|
|
||||||
int m_read_locks;
|
int m_read_locks;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
// Data to save the file in the same format that it was loaded
|
||||||
* Data to save the file in the same format that it was loaded
|
|
||||||
*/
|
|
||||||
FormatOptions *format_options;
|
FormatOptions *format_options;
|
||||||
|
|
||||||
Sprite(int imgtype, int w, int h);
|
Sprite(int imgtype, int w, int h);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user