Minor changes (C style comments to C++ style).

This commit is contained in:
David Capello 2011-04-30 15:29:33 -03:00
parent 132e246ebf
commit 0227467da5
3 changed files with 68 additions and 83 deletions

View File

@ -96,10 +96,9 @@ static WidgetsList mouse_widgets_list; // List of widgets to send mouse events
static JList msg_queue; // Messages queue
static JList msg_filters[NFILTERS]; // Filters for every enqueued message
static JWidget focus_widget; /* the widget with the focus */
static JWidget mouse_widget; /* the widget with the mouse */
static JWidget capture_widget; /* the widget that captures the
mouse */
static Widget* focus_widget; // The widget with the focus
static Widget* mouse_widget; // The widget with the mouse
static Widget* capture_widget; // The widget that captures the mouse
static bool first_time_poll; /* true when we don't enter in poll yet */
@ -1429,15 +1428,15 @@ static Message* new_mouse_msg(int type, JWidget widget)
static void broadcast_key_msg(JWidget manager, Message* msg)
{
/* send the message to the widget with capture */
// Send the message to the widget with capture
if (capture_widget) {
jmessage_add_dest(msg, capture_widget);
}
/* send the msg to the focused widget */
// Send the msg to the focused widget
else if (focus_widget) {
jmessage_add_dest(msg, focus_widget);
}
/* finally, send the message to the manager, it'll know what to do */
// Finally, send the message to the manager, it'll know what to do
else {
jmessage_add_dest(msg, manager);
}

View File

@ -492,7 +492,7 @@ bool MenuBox::onProcessMessage(Message* msg)
JLink link;
bool used = false;
/* search a child with highlight or the submenu opened */
// Search a child with highlight or the submenu opened
JI_LIST_FOR_EACH(menu->children, link) {
Widget* child = (Widget*)link->data;
if (child->type != JI_MENUITEM)
@ -508,22 +508,22 @@ bool MenuBox::onProcessMessage(Message* msg)
switch (msg->key.scancode) {
case KEY_ESC:
/* in menu-bar */
// In menu-bar
if (this->type == JI_MENUBAR) {
if (highlight) {
cancelMenuLoop();
used = true;
}
}
/* in menu-boxes */
// In menu-boxes
else {
if (child_with_submenu_opened) {
child_with_submenu_opened->closeSubmenu(true);
used = true;
}
/* go to parent */
// Go to parent
else if (menu->m_menuitem) {
/* just retrogress one parent-level */
// Just retrogress one parent-level
menu->m_menuitem->closeSubmenu(true);
used = true;
}
@ -531,14 +531,14 @@ bool MenuBox::onProcessMessage(Message* msg)
break;
case KEY_UP:
/* in menu-bar */
// In menu-bar
if (this->type == JI_MENUBAR) {
if (child_with_submenu_opened)
child_with_submenu_opened->closeSubmenu(true);
}
/* in menu-boxes */
// In menu-boxes
else {
/* go to previous */
// Go to previous
highlight = find_previtem(menu, highlight);
menu->highlightItem(highlight, false, false, false);
}
@ -546,14 +546,14 @@ bool MenuBox::onProcessMessage(Message* msg)
break;
case KEY_DOWN:
/* in menu-bar */
// In menu-bar
if (this->type == JI_MENUBAR) {
/* select the active menu */
// Select the active menu
menu->highlightItem(highlight, true, true, true);
}
/* in menu-boxes */
// In menu-boxes
else {
/* go to next */
// Go to next
highlight = find_nextitem(menu, highlight);
menu->highlightItem(highlight, false, false, false);
}
@ -561,31 +561,31 @@ bool MenuBox::onProcessMessage(Message* msg)
break;
case KEY_LEFT:
/* in menu-bar */
// In menu-bar
if (this->type == JI_MENUBAR) {
/* go to previous */
// Go to previous
highlight = find_previtem(menu, highlight);
menu->highlightItem(highlight, false, false, false);
}
/* in menu-boxes */
// In menu-boxes
else {
/* go to parent */
// Go to parent
if (menu->m_menuitem) {
Widget* parent = menu->m_menuitem->parent->parent;
/* go to the previous item in the parent */
// Go to the previous item in the parent
/* if the parent is the menu-bar */
// If the parent is the menu-bar
if (parent->type == JI_MENUBAR) {
menu = static_cast<MenuBar*>(parent)->getMenu();
MenuItem* menuitem = find_previtem(menu, menu->getHighlightedItem());
/* go to previous item in the parent */
// Go to previous item in the parent
menu->highlightItem(menuitem, false, true, true);
}
/* if the parent isn't the menu-bar */
// If the parent isn't the menu-bar
else {
/* just retrogress one parent-level */
// Just retrogress one parent-level
menu->m_menuitem->closeSubmenu(true);
}
}
@ -594,15 +594,15 @@ bool MenuBox::onProcessMessage(Message* msg)
break;
case KEY_RIGHT:
/* in menu-bar */
// In menu-bar
if (this->type == JI_MENUBAR) {
/* go to next */
// Go to next
highlight = find_nextitem(menu, highlight);
menu->highlightItem(highlight, false, false, false);
}
/* in menu-boxes */
// In menu-boxes
else {
/* enter in sub-menu */
// Enter in sub-menu
if ((highlight) && highlight->hasSubmenu()) {
menu->highlightItem(highlight, true, true, true);
}

View File

@ -159,9 +159,7 @@ static bool manager_msg_proc(JWidget widget, Message* msg);
static void on_palette_change_signal();
/**
* Used by set_display_switch_callback(SWITCH_IN, ...).
*/
// Used by set_display_switch_callback(SWITCH_IN, ...).
static void display_switch_in_callback()
{
next_idle_flags |= REFRESH_FULL_SCREEN;
@ -179,9 +177,7 @@ static void resize_callback(RESIZE_DISPLAY_EVENT *ev)
next_idle_flags |= SYSTEM_WINDOW_RESIZE;
}
/**
* Initializes GUI.
*/
// Initializes GUI.
int init_module_gui()
{
int min_possible_dsk_res = 0;
@ -192,38 +188,38 @@ int init_module_gui()
monitors = new MonitorList;
shortcuts = new std::vector<Shortcut*>;
/* install the mouse */
// Install the mouse
if (install_mouse() < 0)
throw base::Exception("Error installing mouse handler");
/* install the keyboard */
// Install the keyboard
if (install_keyboard() < 0)
throw base::Exception("Error installing keyboard handler");
/* disable Ctrl+Shift+End in non-DOS */
// Disable Ctrl+Shift+End in non-DOS
#if !defined(ALLEGRO_DOS)
three_finger_flag = false;
#endif
three_finger_flag = true; /* TODO remove this line */
three_finger_flag = true; // TODO remove this line
/* set the graphics mode... */
// Set the graphics mode...
load_gui_config(w, h, bpp, fullscreen, maximized);
autodetect = fullscreen ? GFX_AUTODETECT_FULLSCREEN:
GFX_AUTODETECT_WINDOWED;
/* default resolution */
// Default resolution
if (!w || !h) {
bool has_desktop = false;
int dsk_w, dsk_h;
has_desktop = get_desktop_resolution(&dsk_w, &dsk_h) == 0;
/* we must extract some space for the windows borders */
// We must extract some space for the windows borders
dsk_w -= 16;
dsk_h -= 32;
/* try to get desktop resolution */
// Try to get desktop resolution
if (has_desktop) {
for (c=0; try_resolutions[c].width; ++c) {
if (try_resolutions[c].width <= dsk_w &&
@ -237,7 +233,7 @@ int init_module_gui()
}
}
}
/* full screen */
// Full screen
else {
fullscreen = true;
w = 320;
@ -246,7 +242,7 @@ int init_module_gui()
}
}
/* default color depth */
// Default color depth
if (!bpp) {
bpp = desktop_color_depth();
if (!bpp)
@ -285,7 +281,7 @@ int init_module_gui()
gfx_done:;
/* create the default-manager */
// Create the default-manager
manager = jmanager_new();
jwidget_add_hook(manager, JI_WIDGET, manager_msg_proc, NULL);
@ -301,16 +297,16 @@ gfx_done:;
}
#endif
/* configure ji_screen */
// Configure ji_screen
gui_setup_screen(true);
/* add a hook to display-switch so when the user returns to the
screen it's completelly refreshed/redrawn */
// Add a hook to display-switch so when the user returns to the
// screen it's completelly refreshed/redrawn.
LOCK_VARIABLE(next_idle_flags);
LOCK_FUNCTION(display_switch_in_callback);
set_display_switch_callback(SWITCH_IN, display_switch_in_callback);
/* set graphics options for next time */
// Set graphics options for next time
save_gui_config();
// Hook for palette change to regenerate the theme
@ -470,7 +466,7 @@ void gui_feedback()
jmanager_refresh_screen();
}
/* menu stuff */
// Menu stuff
if (next_idle_flags & REBUILD_RECENT_LIST) {
if (app_realloc_recent_list())
next_idle_flags ^= REBUILD_RECENT_LIST;
@ -529,12 +525,8 @@ void gui_flip_screen()
lastWorkingGfxMode.updateWithCurrentMode();
}
/**
* Sets the ji_screen variable.
*
* This routine should be called everytime you changes the graphics
* mode.
*/
// Sets the ji_screen variable. This routine should be called
// everytime you changes the graphics mode.
void gui_setup_screen(bool reload_font)
{
bool regen = false;
@ -672,8 +664,8 @@ void schedule_rebuild_recent_list()
next_idle_flags |= REBUILD_RECENT_LIST;
}
/**********************************************************************/
/* hook signals */
//////////////////////////////////////////////////////////////////////
// Hook signals
typedef struct HookData {
int signal_num;
@ -712,9 +704,7 @@ static bool hook_msg_proc(JWidget widget, Message* msg)
return false;
}
/**
* @warning You can't use this function for the same widget two times.
*/
// @warning You can't use this function for the same widget two times.
void hook_signal(JWidget widget,
int signal_num,
bool (*signal_handler)(JWidget widget, void* data),
@ -814,9 +804,9 @@ void set_gfxicon_to_button(ButtonBase* button,
button->setIconInterface(buttonIcon);
}
/**********************************************************************/
/* Button style (convert radio or check buttons and draw it like
normal buttons) */
//////////////////////////////////////////////////////////////////////
// Button style (convert radio or check buttons and draw it like
// normal buttons)
RadioButton* radio_button_new(int radio_group, int b1, int b2, int b3, int b4)
{
@ -1035,11 +1025,9 @@ static Shortcut* get_keyboard_shortcut_for_quicktool(tools::Tool* tool)
return NULL;
}
/**
* Adds a routine to be called each 100 milliseconds to monitor
* whatever you want. It's mainly used to monitor the progress of a
* file-operation (see @ref fop_operate)
*/
// Adds a routine to be called each 100 milliseconds to monitor
// whatever you want. It's mainly used to monitor the progress of a
// file-operation (see @ref fop_operate)
Monitor* add_gui_monitor(void (*proc)(void *),
void (*free)(void *), void *data)
{
@ -1055,9 +1043,7 @@ Monitor* add_gui_monitor(void (*proc)(void *),
return monitor;
}
/**
* Removes and frees a previously added monitor.
*/
// Removes and frees a previously added monitor.
void remove_gui_monitor(Monitor* monitor)
{
MonitorList::iterator it =
@ -1088,7 +1074,7 @@ static bool manager_msg_proc(JWidget widget, Message* msg)
case JM_QUEUEPROCESSING:
gui_feedback();
/* open dropped files */
// Open dropped files
check_for_dropped_files();
break;
@ -1185,26 +1171,26 @@ static bool manager_msg_proc(JWidget widget, Message* msg)
case Shortcut_ExecuteCommand: {
Command* command = shortcut->command;
// the screen shot is available in everywhere
// The screen shot is available in everywhere
if (strcmp(command->short_name(), CommandId::ScreenShot) == 0) {
UIContext::instance()->executeCommand(command, shortcut->params);
return true;
}
// all other keys are only available in the main-window
// All other keys are only available in the main-window
else {
JLink link;
JI_LIST_FOR_EACH(widget->children, link) {
Frame* child = reinterpret_cast<Frame*>(link->data);
/* there are a foreground window executing? */
// There are a foreground window executing?
if (child->is_foreground()) {
break;
}
/* is it the desktop and the top-window= */
// Is it the desktop and the top-window=
else if (child->is_desktop() && child == app_get_top_window()) {
/* ok, so we can execute the command represented by the
pressed-key in the message... */
// OK, so we can execute the command represented
// by the pressed-key in the message...
UIContext::instance()->executeCommand(command, shortcut->params);
return true;
}