mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Fixed a lot of VC++8 warnings with /W3 flag.
This commit is contained in:
parent
2bc2db1630
commit
05803abaa1
3
config.h
3
config.h
@ -21,10 +21,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __ASE_CONFIG_H
|
#define __ASE_CONFIG_H
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
/* general information */
|
/* general information */
|
||||||
#define PACKAGE "ASE"
|
#define PACKAGE "ASE"
|
||||||
#define VERSION "0.7.1"
|
#define VERSION "0.7.2"
|
||||||
#define WEBSITE "http://www.aseprite.org/"
|
#define WEBSITE "http://www.aseprite.org/"
|
||||||
#define COPYRIGHT "Copyright (C) 2001-2009 David Capello"
|
#define COPYRIGHT "Copyright (C) 2001-2009 David Capello"
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ OBJ_DIR = obj/msvc
|
|||||||
include makefile.lst
|
include makefile.lst
|
||||||
|
|
||||||
CFLAGS = -nologo \
|
CFLAGS = -nologo \
|
||||||
-I. -Isrc -Ithird_party -W1 -Gd -EHa \
|
-I. -Isrc -Ithird_party -W3 -Gd -EHa \
|
||||||
-I$(LIBFREETYPE_DIR)/include \
|
-I$(LIBFREETYPE_DIR)/include \
|
||||||
-I$(LIBJPEG_DIR) \
|
-I$(LIBJPEG_DIR) \
|
||||||
-I$(LIBPNG_DIR) \
|
-I$(LIBPNG_DIR) \
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
static bool cmd_duplicate_sprite_enabled(const char *argument)
|
static bool cmd_duplicate_sprite_enabled(const char *argument)
|
||||||
{
|
{
|
||||||
const CurrentSpriteReader sprite;
|
const CurrentSpriteReader sprite;
|
||||||
return sprite;
|
return sprite.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_duplicate_sprite_execute(const char *argument)
|
static void cmd_duplicate_sprite_execute(const char *argument)
|
||||||
|
@ -59,7 +59,7 @@ static void cmd_flip_execute(const char *argument)
|
|||||||
"Flip Canvas Vertical"));
|
"Flip Canvas Vertical"));
|
||||||
|
|
||||||
if (flip_mask) {
|
if (flip_mask) {
|
||||||
Image *image, *area;
|
Image* image;
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ static bool cmd_show_grid_checked(const char *argument)
|
|||||||
|
|
||||||
static void cmd_show_grid_execute(const char *argument)
|
static void cmd_show_grid_execute(const char *argument)
|
||||||
{
|
{
|
||||||
set_view_grid(get_view_grid() ? FALSE: TRUE);
|
set_view_grid(get_view_grid() ? false: true);
|
||||||
refresh_all_editors();
|
refresh_all_editors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ static void cmd_snap_to_grid_execute(const char *argument)
|
|||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
set_use_grid(get_use_grid() ? FALSE: TRUE);
|
set_use_grid(get_use_grid() ? false: true);
|
||||||
refresh_all_editors();
|
refresh_all_editors();
|
||||||
|
|
||||||
usprintf(buf, _("Snap to grid: %s"),
|
usprintf(buf, _("Snap to grid: %s"),
|
||||||
|
@ -34,7 +34,7 @@ static int get_max_layer_num(Layer* layer);
|
|||||||
static bool cmd_new_layer_enabled(const char* argument)
|
static bool cmd_new_layer_enabled(const char* argument)
|
||||||
{
|
{
|
||||||
const CurrentSpriteReader sprite;
|
const CurrentSpriteReader sprite;
|
||||||
return sprite;
|
return sprite.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_new_layer_execute(const char* argument)
|
static void cmd_new_layer_execute(const char* argument)
|
||||||
|
@ -319,10 +319,10 @@ static void save_command(JWidget widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (palette_save(paledit_get_palette(palette_editor),
|
if (!palette_save(paledit_get_palette(palette_editor), filename.c_str())) {
|
||||||
filename.c_str()))
|
|
||||||
jalert(_("Error<<Saving palette file||&Close"));
|
jalert(_("Error<<Saving palette file||&Close"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ramp_command(JWidget widget)
|
static void ramp_command(JWidget widget)
|
||||||
|
@ -199,7 +199,7 @@ static void save_as_dialog(Sprite* sprite, const char* dlg_title, bool mark_as_s
|
|||||||
static bool cmd_save_file_enabled(const char *argument)
|
static bool cmd_save_file_enabled(const char *argument)
|
||||||
{
|
{
|
||||||
const CurrentSpriteReader sprite;
|
const CurrentSpriteReader sprite;
|
||||||
return sprite;
|
return sprite.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,7 +123,7 @@ void verbose_printf(const char *format, ...)
|
|||||||
*/
|
*/
|
||||||
bool is_interactive()
|
bool is_interactive()
|
||||||
{
|
{
|
||||||
return ase_mode & MODE_GUI ? TRUE: FALSE;
|
return ase_mode & MODE_GUI ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_pretty_memsize(unsigned int memsize, char *buf, unsigned int bufsize)
|
char *get_pretty_memsize(unsigned int memsize, char *buf, unsigned int bufsize)
|
||||||
|
@ -27,11 +27,11 @@
|
|||||||
#include "raster/palette.h"
|
#include "raster/palette.h"
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
bool tiled;
|
tiled_t tiled;
|
||||||
int w, h;
|
int w, h;
|
||||||
int ncolors;
|
int ncolors;
|
||||||
unsigned char *channel[4];
|
unsigned char *channel[4];
|
||||||
} data = { FALSE, 0, 0, 0, { NULL, NULL, NULL, NULL } };
|
} data = { TILED_NONE, 0, 0, 0, { NULL, NULL, NULL, NULL } };
|
||||||
|
|
||||||
void set_median_size(int w, int h)
|
void set_median_size(int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ gif_save_animation (const char *filename, GIF_ANIMATION *gif,
|
|||||||
int i, j;
|
int i, j;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
file = fopen (filename, "wb");
|
file = fopen(filename, "wb");
|
||||||
if (!file)
|
if (!file)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -442,5 +442,5 @@ static bool save_GIF(FileOp *fop)
|
|||||||
ret = gif_save_animation(fop->filename, gif,
|
ret = gif_save_animation(fop->filename, gif,
|
||||||
reinterpret_cast<void(*)(void*,float)>(fop_progress), fop);
|
reinterpret_cast<void(*)(void*,float)>(fop_progress), fop);
|
||||||
gif_destroy_animation(gif);
|
gif_destroy_animation(gif);
|
||||||
return ret == 0 ? TRUE: FALSE;
|
return ret == 0 ? true: false;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ static bool load_PNG(FileOp *fop)
|
|||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
|
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
|
||||||
register ase_uint8 *src_address = row_pointer;
|
register ase_uint8 *src_address = row_pointer;
|
||||||
register ase_uint32 *dst_address = ((ase_uint32 **)image->line)[y];
|
register ase_uint32 *dst_address = ((ase_uint32 **)image->line)[y];
|
||||||
register int x, r, g, b, a;
|
register unsigned int x, r, g, b, a;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
r = *(src_address++);
|
r = *(src_address++);
|
||||||
@ -229,7 +229,7 @@ static bool load_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
|
||||||
register ase_uint8 *src_address = row_pointer;
|
register ase_uint8 *src_address = row_pointer;
|
||||||
register ase_uint32 *dst_address = ((ase_uint32 **)image->line)[y];
|
register ase_uint32 *dst_address = ((ase_uint32 **)image->line)[y];
|
||||||
register int x, r, g, b;
|
register unsigned int x, r, g, b;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
r = *(src_address++);
|
r = *(src_address++);
|
||||||
@ -242,7 +242,7 @@ static bool load_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||||
register ase_uint8 *src_address = row_pointer;
|
register ase_uint8 *src_address = row_pointer;
|
||||||
register ase_uint16 *dst_address = ((ase_uint16 **)image->line)[y];
|
register ase_uint16 *dst_address = ((ase_uint16 **)image->line)[y];
|
||||||
register int x, k, a;
|
register unsigned int x, k, a;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
k = *(src_address++);
|
k = *(src_address++);
|
||||||
@ -254,7 +254,7 @@ static bool load_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
|
||||||
register ase_uint8 *src_address = row_pointer;
|
register ase_uint8 *src_address = row_pointer;
|
||||||
register ase_uint16 *dst_address = ((ase_uint16 **)image->line)[y];
|
register ase_uint16 *dst_address = ((ase_uint16 **)image->line)[y];
|
||||||
int x, k;
|
register unsigned int x, k;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
k = *(src_address++);
|
k = *(src_address++);
|
||||||
@ -265,7 +265,7 @@ static bool load_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||||
register ase_uint8 *src_address = row_pointer;
|
register ase_uint8 *src_address = row_pointer;
|
||||||
register ase_uint8 *dst_address = ((ase_uint8 **)image->line)[y];
|
register ase_uint8 *dst_address = ((ase_uint8 **)image->line)[y];
|
||||||
register int x, c;
|
register unsigned int x, c;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
c = *(src_address++);
|
c = *(src_address++);
|
||||||
@ -414,7 +414,7 @@ static bool save_PNG(FileOp *fop)
|
|||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
|
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
|
||||||
register ase_uint32 *src_address = ((ase_uint32 **)image->line)[y];
|
register ase_uint32 *src_address = ((ase_uint32 **)image->line)[y];
|
||||||
register ase_uint8 *dst_address = row_pointer;
|
register ase_uint8 *dst_address = row_pointer;
|
||||||
register int x, c;
|
register unsigned int x, c;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
c = *(src_address++);
|
c = *(src_address++);
|
||||||
@ -428,7 +428,7 @@ static bool save_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
|
||||||
register ase_uint32 *src_address = ((ase_uint32 **)image->line)[y];
|
register ase_uint32 *src_address = ((ase_uint32 **)image->line)[y];
|
||||||
register ase_uint8 *dst_address = row_pointer;
|
register ase_uint8 *dst_address = row_pointer;
|
||||||
register int x, c;
|
register unsigned int x, c;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
c = *(src_address++);
|
c = *(src_address++);
|
||||||
@ -441,7 +441,7 @@ static bool save_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||||
register ase_uint16 *src_address = ((ase_uint16 **)image->line)[y];
|
register ase_uint16 *src_address = ((ase_uint16 **)image->line)[y];
|
||||||
register ase_uint8 *dst_address = row_pointer;
|
register ase_uint8 *dst_address = row_pointer;
|
||||||
register int x, c;
|
register unsigned int x, c;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
c = *(src_address++);
|
c = *(src_address++);
|
||||||
@ -453,7 +453,7 @@ static bool save_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
|
||||||
register ase_uint16 *src_address = ((ase_uint16 **)image->line)[y];
|
register ase_uint16 *src_address = ((ase_uint16 **)image->line)[y];
|
||||||
register ase_uint8 *dst_address = row_pointer;
|
register ase_uint8 *dst_address = row_pointer;
|
||||||
register int x, c;
|
register unsigned int x, c;
|
||||||
|
|
||||||
for (x=0; x<width; x++) {
|
for (x=0; x<width; x++) {
|
||||||
c = *(src_address++);
|
c = *(src_address++);
|
||||||
@ -464,7 +464,7 @@ static bool save_PNG(FileOp *fop)
|
|||||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
|
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||||
register ase_uint8 *src_address = ((ase_uint8 **)image->line)[y];
|
register ase_uint8 *src_address = ((ase_uint8 **)image->line)[y];
|
||||||
register ase_uint8 *dst_address = row_pointer;
|
register ase_uint8 *dst_address = row_pointer;
|
||||||
register int x;
|
register unsigned int x;
|
||||||
|
|
||||||
for (x=0; x<width; x++)
|
for (x=0; x<width; x++)
|
||||||
*(dst_address++) = *(src_address++);
|
*(dst_address++) = *(src_address++);
|
||||||
|
@ -402,7 +402,7 @@ static bool save_TGA(FileOp *fop)
|
|||||||
unsigned char image_palette[256][3];
|
unsigned char image_palette[256][3];
|
||||||
int x, y, c, r, g, b;
|
int x, y, c, r, g, b;
|
||||||
int depth = (image->imgtype == IMAGE_RGB) ? 32 : 8;
|
int depth = (image->imgtype == IMAGE_RGB) ? 32 : 8;
|
||||||
bool need_pal = (image->imgtype == IMAGE_INDEXED)? TRUE: FALSE;
|
bool need_pal = (image->imgtype == IMAGE_INDEXED)? true: false;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
f = fopen(fop->filename, "wb");
|
f = fopen(fop->filename, "wb");
|
||||||
|
@ -144,10 +144,10 @@ int jalert(const char *format, ...)
|
|||||||
static JWidget create_alert(char *buf, JList *labels, JList *buttons)
|
static JWidget create_alert(char *buf, JList *labels, JList *buttons)
|
||||||
{
|
{
|
||||||
JWidget box1, box2, grid, box3, box4, box5, window = NULL;
|
JWidget box1, box2, grid, box3, box4, box5, window = NULL;
|
||||||
bool title = TRUE;
|
bool title = true;
|
||||||
bool label = FALSE;
|
bool label = false;
|
||||||
bool separator = FALSE;
|
bool separator = false;
|
||||||
bool button = FALSE;
|
bool button = false;
|
||||||
int align = 0;
|
int align = 0;
|
||||||
char *beg;
|
char *beg;
|
||||||
int c, chr;
|
int c, chr;
|
||||||
@ -197,16 +197,16 @@ static JWidget create_alert(char *buf, JList *labels, JList *buttons)
|
|||||||
break;
|
break;
|
||||||
/* next widget */
|
/* next widget */
|
||||||
else {
|
else {
|
||||||
title = label = separator = button = FALSE;
|
title = label = separator = button = false;
|
||||||
beg = buf+c+2;
|
beg = buf+c+2;
|
||||||
align = 0;
|
align = 0;
|
||||||
|
|
||||||
switch (buf[c]) {
|
switch (buf[c]) {
|
||||||
case '<': label=TRUE; align=JI_LEFT; break;
|
case '<': label=true; align=JI_LEFT; break;
|
||||||
case '=': label=TRUE; align=JI_CENTER; break;
|
case '=': label=true; align=JI_CENTER; break;
|
||||||
case '>': label=TRUE; align=JI_RIGHT; break;
|
case '>': label=true; align=JI_RIGHT; break;
|
||||||
case '-': separator=TRUE; break;
|
case '-': separator=true; break;
|
||||||
case '|': button=TRUE; break;
|
case '|': button=true; break;
|
||||||
}
|
}
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ static JWidget create_alert(char *buf, JList *labels, JList *buttons)
|
|||||||
if (window) {
|
if (window) {
|
||||||
box1 = jbox_new(JI_VERTICAL);
|
box1 = jbox_new(JI_VERTICAL);
|
||||||
box2 = jbox_new(JI_VERTICAL);
|
box2 = jbox_new(JI_VERTICAL);
|
||||||
grid = jgrid_new(1, FALSE);
|
grid = jgrid_new(1, false);
|
||||||
box3 = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
box3 = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||||
|
|
||||||
/* to identify by the user */
|
/* to identify by the user */
|
||||||
@ -227,8 +227,8 @@ static JWidget create_alert(char *buf, JList *labels, JList *buttons)
|
|||||||
box4 = jbox_new(0);
|
box4 = jbox_new(0);
|
||||||
box5 = jbox_new(0);
|
box5 = jbox_new(0);
|
||||||
|
|
||||||
jwidget_expansive(box4, TRUE);
|
jwidget_expansive(box4, true);
|
||||||
jwidget_expansive(box5, TRUE);
|
jwidget_expansive(box5, true);
|
||||||
jwidget_noborders(box4);
|
jwidget_noborders(box4);
|
||||||
jwidget_noborders(box5);
|
jwidget_noborders(box5);
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ static JWidget create_alert(char *buf, JList *labels, JList *buttons)
|
|||||||
|
|
||||||
/* default button is the last one */
|
/* default button is the last one */
|
||||||
if (jlist_last(*buttons))
|
if (jlist_last(*buttons))
|
||||||
jwidget_magnetic((JWidget)jlist_last(*buttons)->data, TRUE);
|
jwidget_magnetic((JWidget)jlist_last(*buttons)->data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
|
@ -94,7 +94,7 @@ JWidget ji_generic_button_new(const char *text,
|
|||||||
jwidget_add_hook(widget, behavior_type, button_msg_proc, button);
|
jwidget_add_hook(widget, behavior_type, button_msg_proc, button);
|
||||||
jwidget_set_align(widget, JI_CENTER | JI_MIDDLE);
|
jwidget_set_align(widget, JI_CENTER | JI_MIDDLE);
|
||||||
jwidget_set_text(widget, text);
|
jwidget_set_text(widget, text);
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_init_theme(widget);
|
jwidget_init_theme(widget);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
@ -171,7 +171,7 @@ void jbutton_add_command(JWidget widget,
|
|||||||
Button* button = reinterpret_cast<Button*>(jwidget_get_data(widget, widget->type));
|
Button* button = reinterpret_cast<Button*>(jwidget_get_data(widget, widget->type));
|
||||||
ButtonCommand* command = (ButtonCommand*)jnew(ButtonCommand, 1);
|
ButtonCommand* command = (ButtonCommand*)jnew(ButtonCommand, 1);
|
||||||
|
|
||||||
command->use_data = FALSE;
|
command->use_data = false;
|
||||||
command->proc = (void *)command_proc;
|
command->proc = (void *)command_proc;
|
||||||
command->data = NULL;
|
command->data = NULL;
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ void jbutton_add_command_data(JWidget widget,
|
|||||||
Button* button = reinterpret_cast<Button*>(jwidget_get_data(widget, widget->type));
|
Button* button = reinterpret_cast<Button*>(jwidget_get_data(widget, widget->type));
|
||||||
ButtonCommand* command = jnew(ButtonCommand, 1);
|
ButtonCommand* command = jnew(ButtonCommand, 1);
|
||||||
|
|
||||||
command->use_data = TRUE;
|
command->use_data = true;
|
||||||
command->proc = (void *)command_proc;
|
command->proc = (void *)command_proc;
|
||||||
command->data = data;
|
command->data = data;
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
button_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
button_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SIGNAL:
|
case JM_SIGNAL:
|
||||||
if (widget->type == JI_RADIO) {
|
if (widget->type == JI_RADIO) {
|
||||||
@ -302,14 +302,14 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
(msg->key.scancode == KEY_ENTER_PAD) ||
|
(msg->key.scancode == KEY_ENTER_PAD) ||
|
||||||
(msg->key.scancode == KEY_SPACE)) {
|
(msg->key.scancode == KEY_SPACE)) {
|
||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* the underscored letter with Alt */
|
/* the underscored letter with Alt */
|
||||||
if ((msg->any.shifts & KB_ALT_FLAG) &&
|
if ((msg->any.shifts & KB_ALT_FLAG) &&
|
||||||
(jwidget_check_underscored(widget, msg->key.scancode))) {
|
(jwidget_check_underscored(widget, msg->key.scancode))) {
|
||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/* magnetic */
|
/* magnetic */
|
||||||
else if (jwidget_is_magnetic(widget) &&
|
else if (jwidget_is_magnetic(widget) &&
|
||||||
@ -322,7 +322,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jmanager_dispatch_messages(ji_get_default_manager());
|
jmanager_dispatch_messages(ji_get_default_manager());
|
||||||
|
|
||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* for JI_CHECK or JI_RADIO */
|
/* for JI_CHECK or JI_RADIO */
|
||||||
@ -350,7 +350,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_emit_signal(widget, JI_SIGNAL_RADIO_CHANGE);
|
jwidget_emit_signal(widget, JI_SIGNAL_RADIO_CHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (widget->type == JI_BUTTON) {
|
if (widget->type == JI_BUTTON) {
|
||||||
if (jwidget_is_selected(widget)) {
|
if (jwidget_is_selected(widget)) {
|
||||||
button_selected_signal(widget);
|
button_selected_signal(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
jwidget_capture_mouse(widget);
|
jwidget_capture_mouse(widget);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JI_CHECK:
|
case JI_CHECK:
|
||||||
if (jwidget_is_enabled(widget)) {
|
if (jwidget_is_enabled(widget)) {
|
||||||
@ -386,7 +386,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
jwidget_capture_mouse(widget);
|
jwidget_capture_mouse(widget);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JI_RADIO:
|
case JI_RADIO:
|
||||||
if (jwidget_is_enabled(widget)) {
|
if (jwidget_is_enabled(widget)) {
|
||||||
@ -398,7 +398,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_capture_mouse(widget);
|
jwidget_capture_mouse(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ static bool button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void button_request_size(JWidget widget, int *w, int *h)
|
static void button_request_size(JWidget widget, int *w, int *h)
|
||||||
@ -487,21 +487,19 @@ static void button_request_size(JWidget widget, int *w, int *h)
|
|||||||
|
|
||||||
static void button_selected_signal(JWidget widget)
|
static void button_selected_signal(JWidget widget)
|
||||||
{
|
{
|
||||||
bool used;
|
// deselect
|
||||||
|
|
||||||
/* deselect */
|
|
||||||
jwidget_deselect(widget);
|
jwidget_deselect(widget);
|
||||||
|
|
||||||
/* emit the signal */
|
// emit the signal
|
||||||
used = jwidget_emit_signal(widget, JI_SIGNAL_BUTTON_SELECT);
|
bool used = jwidget_emit_signal(widget, JI_SIGNAL_BUTTON_SELECT);
|
||||||
|
|
||||||
/* not used? */
|
// not used?
|
||||||
if (!used) {
|
if (!used) {
|
||||||
Button* button = reinterpret_cast<Button*>(jwidget_get_data(widget, widget->type));
|
Button* button = reinterpret_cast<Button*>(jwidget_get_data(widget, widget->type));
|
||||||
|
|
||||||
/* call commands */
|
/* call commands */
|
||||||
if (!jlist_empty(button->commands)) {
|
if (!jlist_empty(button->commands)) {
|
||||||
ButtonCommand *command;
|
ButtonCommand* command;
|
||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(button->commands, link) {
|
JI_LIST_FOR_EACH(button->commands, link) {
|
||||||
|
@ -80,9 +80,9 @@ JWidget jcombobox_new()
|
|||||||
combobox->window = NULL;
|
combobox->window = NULL;
|
||||||
combobox->items = jlist_new();
|
combobox->items = jlist_new();
|
||||||
combobox->selected = 0;
|
combobox->selected = 0;
|
||||||
combobox->editable = FALSE;
|
combobox->editable = false;
|
||||||
combobox->clickopen = TRUE;
|
combobox->clickopen = true;
|
||||||
combobox->casesensitive = TRUE;
|
combobox->casesensitive = true;
|
||||||
|
|
||||||
combobox->entry->user_data[0] = widget;
|
combobox->entry->user_data[0] = widget;
|
||||||
combobox->button->user_data[0] = widget;
|
combobox->button->user_data[0] = widget;
|
||||||
@ -90,11 +90,11 @@ JWidget jcombobox_new()
|
|||||||
/* TODO this separation should be from the JTheme */
|
/* TODO this separation should be from the JTheme */
|
||||||
widget->child_spacing = 0;
|
widget->child_spacing = 0;
|
||||||
|
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_add_hook(widget, JI_COMBOBOX, combobox_msg_proc, combobox);
|
jwidget_add_hook(widget, JI_COMBOBOX, combobox_msg_proc, combobox);
|
||||||
jwidget_add_hook(combobox->entry, JI_WIDGET, combobox_entry_msg_proc, NULL);
|
jwidget_add_hook(combobox->entry, JI_WIDGET, combobox_entry_msg_proc, NULL);
|
||||||
|
|
||||||
jwidget_expansive(combobox->entry, TRUE);
|
jwidget_expansive(combobox->entry, true);
|
||||||
jbutton_set_bevel(combobox->button, 0, 2, 0, 2);
|
jbutton_set_bevel(combobox->button, 0, 2, 0, 2);
|
||||||
jbutton_add_command_data(combobox->button, combobox_button_cmd, widget);
|
jbutton_add_command_data(combobox->button, combobox_button_cmd, widget);
|
||||||
|
|
||||||
@ -115,11 +115,11 @@ void jcombobox_editable(JWidget widget, bool state)
|
|||||||
combobox->editable = state;
|
combobox->editable = state;
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
jentry_readonly(combobox->entry, FALSE);
|
jentry_readonly(combobox->entry, false);
|
||||||
jentry_show_cursor(combobox->entry);
|
jentry_show_cursor(combobox->entry);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
jentry_readonly(combobox->entry, TRUE);
|
jentry_readonly(combobox->entry, true);
|
||||||
jentry_hide_cursor(combobox->entry);
|
jentry_hide_cursor(combobox->entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ static bool combobox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
msg->reqsize.w += w;
|
msg->reqsize.w += w;
|
||||||
msg->reqsize.h = MAX(msg->reqsize.h, h);
|
msg->reqsize.h = MAX(msg->reqsize.h, h);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_SETPOS: {
|
case JM_SETPOS: {
|
||||||
@ -352,7 +352,7 @@ static bool combobox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_set_rect(combobox->entry, cbox);
|
jwidget_set_rect(combobox->entry, cbox);
|
||||||
|
|
||||||
jrect_free(cbox);
|
jrect_free(cbox);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_WINMOVE:
|
case JM_WINMOVE:
|
||||||
@ -367,14 +367,14 @@ static bool combobox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (combobox->window != NULL) {
|
if (combobox->window != NULL) {
|
||||||
if (!jwidget_has_mouse(jwidget_get_view(combobox->listbox))) {
|
if (!jwidget_has_mouse(jwidget_get_view(combobox->listbox))) {
|
||||||
combobox_close_window(widget);
|
combobox_close_window(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool combobox_entry_msg_proc(JWidget widget, JMessage msg)
|
static bool combobox_entry_msg_proc(JWidget widget, JMessage msg)
|
||||||
@ -390,14 +390,14 @@ static bool combobox_entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
msg->key.scancode == KEY_ENTER ||
|
msg->key.scancode == KEY_ENTER ||
|
||||||
msg->key.scancode == KEY_ENTER_PAD) {
|
msg->key.scancode == KEY_ENTER_PAD) {
|
||||||
combobox_switch_window(combo_widget);
|
combobox_switch_window(combo_widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (msg->key.scancode == KEY_ENTER ||
|
if (msg->key.scancode == KEY_ENTER ||
|
||||||
msg->key.scancode == KEY_ENTER_PAD) {
|
msg->key.scancode == KEY_ENTER_PAD) {
|
||||||
combobox_switch_window(combo_widget);
|
combobox_switch_window(combo_widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,11 +413,11 @@ static bool combobox_entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jmanager_set_focus(widget);
|
jmanager_set_focus(widget);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return TRUE;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool combobox_listbox_msg_proc(JWidget widget, JMessage msg)
|
static bool combobox_listbox_msg_proc(JWidget widget, JMessage msg)
|
||||||
@ -447,7 +447,7 @@ static bool combobox_listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (IS_VALID_ITEM(combo_widget, index))
|
if (IS_VALID_ITEM(combo_widget, index))
|
||||||
jwidget_emit_signal(combo_widget, JI_SIGNAL_COMBOBOX_SELECT);
|
jwidget_emit_signal(combo_widget, JI_SIGNAL_COMBOBOX_SELECT);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
/* case JM_IDLE: { */
|
/* case JM_IDLE: { */
|
||||||
/* /\* if the user clicks outside the listbox *\/ */
|
/* /\* if the user clicks outside the listbox *\/ */
|
||||||
@ -458,7 +458,7 @@ static bool combobox_listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
/* combobox->button && !jwidget_has_mouse(combobox->button) && */
|
/* combobox->button && !jwidget_has_mouse(combobox->button) && */
|
||||||
/* combobox->window && !jwidget_has_mouse(combobox->window)) { */
|
/* combobox->window && !jwidget_has_mouse(combobox->window)) { */
|
||||||
/* combobox_close_window(combo_widget); */
|
/* combobox_close_window(combo_widget); */
|
||||||
/* return TRUE; */
|
/* return true; */
|
||||||
/* } */
|
/* } */
|
||||||
/* } */
|
/* } */
|
||||||
/* break; */
|
/* break; */
|
||||||
@ -470,13 +470,13 @@ static bool combobox_listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
msg->key.scancode == KEY_ENTER ||
|
msg->key.scancode == KEY_ENTER ||
|
||||||
msg->key.scancode == KEY_ENTER_PAD) {
|
msg->key.scancode == KEY_ENTER_PAD) {
|
||||||
combobox_close_window(combo_widget);
|
combobox_close_window(combo_widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void combobox_button_cmd(JWidget widget, void *data)
|
static void combobox_button_cmd(JWidget widget, void *data)
|
||||||
@ -507,7 +507,7 @@ static void combobox_open_window(JWidget widget)
|
|||||||
jlistitem_new(item->text));
|
jlistitem_new(item->text));
|
||||||
}
|
}
|
||||||
|
|
||||||
jwindow_ontop(combobox->window, TRUE);
|
jwindow_ontop(combobox->window, true);
|
||||||
jwidget_noborders(combobox->window);
|
jwidget_noborders(combobox->window);
|
||||||
|
|
||||||
size = jlist_length(combobox->items);
|
size = jlist_length(combobox->items);
|
||||||
|
@ -68,7 +68,7 @@ namespace EntryCmd {
|
|||||||
|
|
||||||
typedef struct Entry
|
typedef struct Entry
|
||||||
{
|
{
|
||||||
int maxsize;
|
size_t maxsize;
|
||||||
int cursor;
|
int cursor;
|
||||||
int scroll;
|
int scroll;
|
||||||
int select;
|
int select;
|
||||||
@ -89,7 +89,7 @@ static void entry_execute_cmd(JWidget widget, EntryCmd::Type cmd, int ascii, boo
|
|||||||
static void entry_forward_word(JWidget widget);
|
static void entry_forward_word(JWidget widget);
|
||||||
static void entry_backward_word(JWidget widget);
|
static void entry_backward_word(JWidget widget);
|
||||||
|
|
||||||
JWidget jentry_new(int maxsize, const char *format, ...)
|
JWidget jentry_new(size_t maxsize, const char *format, ...)
|
||||||
{
|
{
|
||||||
JWidget widget = jwidget_new(JI_ENTRY);
|
JWidget widget = jwidget_new(JI_ENTRY);
|
||||||
Entry* entry = (Entry*)jnew(Entry, 1);
|
Entry* entry = (Entry*)jnew(Entry, 1);
|
||||||
@ -114,17 +114,17 @@ JWidget jentry_new(int maxsize, const char *format, ...)
|
|||||||
entry->scroll = 0;
|
entry->scroll = 0;
|
||||||
entry->select = 0;
|
entry->select = 0;
|
||||||
entry->timer_id = jmanager_add_timer(widget, 500);
|
entry->timer_id = jmanager_add_timer(widget, 500);
|
||||||
entry->hidden = FALSE;
|
entry->hidden = false;
|
||||||
entry->state = FALSE;
|
entry->state = false;
|
||||||
entry->password = FALSE;
|
entry->password = false;
|
||||||
entry->readonly = FALSE;
|
entry->readonly = false;
|
||||||
entry->recent_focused = FALSE;
|
entry->recent_focused = false;
|
||||||
|
|
||||||
/* TODO support for text alignment and multi-line */
|
/* TODO support for text alignment and multi-line */
|
||||||
/* widget->align = JI_LEFT | JI_MIDDLE; */
|
/* widget->align = JI_LEFT | JI_MIDDLE; */
|
||||||
widget->text(buf);
|
widget->text(buf);
|
||||||
|
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_init_theme(widget);
|
jwidget_init_theme(widget);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
@ -162,7 +162,7 @@ void jentry_show_cursor(JWidget widget)
|
|||||||
{
|
{
|
||||||
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
||||||
|
|
||||||
entry->hidden = FALSE;
|
entry->hidden = false;
|
||||||
|
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ void jentry_hide_cursor(JWidget widget)
|
|||||||
{
|
{
|
||||||
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
Entry* entry = reinterpret_cast<Entry*>(jwidget_get_data(widget, JI_ENTRY));
|
||||||
|
|
||||||
entry->hidden = TRUE;
|
entry->hidden = true;
|
||||||
|
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ void jentry_set_cursor_pos(JWidget widget, int pos)
|
|||||||
} while (entry->cursor >= c);
|
} while (entry->cursor >= c);
|
||||||
|
|
||||||
jmanager_start_timer(entry->timer_id);
|
jmanager_start_timer(entry->timer_id);
|
||||||
entry->state = TRUE;
|
entry->state = true;
|
||||||
|
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
@ -262,12 +262,13 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
entry_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
entry_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_TIMER:
|
case JM_TIMER:
|
||||||
if (jwidget_has_focus(widget) &&
|
if (jwidget_has_focus(widget) &&
|
||||||
msg->timer.timer_id == entry->timer_id) {
|
msg->timer.timer_id == entry->timer_id) {
|
||||||
entry->state = entry->state ? FALSE: TRUE;
|
// blinking cursor
|
||||||
|
entry->state = entry->state ? false: true;
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -275,11 +276,11 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
case JM_FOCUSENTER:
|
case JM_FOCUSENTER:
|
||||||
jmanager_start_timer(entry->timer_id);
|
jmanager_start_timer(entry->timer_id);
|
||||||
|
|
||||||
entry->state = TRUE;
|
entry->state = true;
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
|
|
||||||
jentry_select_text(widget, 0, -1);
|
jentry_select_text(widget, 0, -1);
|
||||||
entry->recent_focused = TRUE;
|
entry->recent_focused = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_FOCUSLEAVE:
|
case JM_FOCUSLEAVE:
|
||||||
@ -288,7 +289,7 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jmanager_stop_timer(entry->timer_id);
|
jmanager_stop_timer(entry->timer_id);
|
||||||
|
|
||||||
jentry_deselect_text(widget);
|
jentry_deselect_text(widget);
|
||||||
entry->recent_focused = FALSE;
|
entry->recent_focused = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_KEYPRESSED:
|
case JM_KEYPRESSED:
|
||||||
@ -374,15 +375,15 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
bool move, dirty;
|
bool move, dirty;
|
||||||
int c, x;
|
int c, x;
|
||||||
|
|
||||||
move = TRUE;
|
move = true;
|
||||||
dirty = FALSE;
|
dirty = false;
|
||||||
|
|
||||||
/* backward scroll */
|
/* backward scroll */
|
||||||
if (msg->mouse.x < widget->rc->x1) {
|
if (msg->mouse.x < widget->rc->x1) {
|
||||||
if (entry->scroll > 0) {
|
if (entry->scroll > 0) {
|
||||||
entry->cursor = --entry->scroll;
|
entry->cursor = --entry->scroll;
|
||||||
move = FALSE;
|
move = false;
|
||||||
dirty = TRUE;
|
dirty = true;
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,8 +403,8 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
entry->cursor = c;
|
entry->cursor = c;
|
||||||
move = FALSE;
|
move = false;
|
||||||
dirty = TRUE;
|
dirty = true;
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -414,14 +415,14 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
if (entry->cursor != c) {
|
if (entry->cursor != c) {
|
||||||
entry->cursor = c;
|
entry->cursor = c;
|
||||||
dirty = TRUE;
|
dirty = true;
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move selection */
|
/* move selection */
|
||||||
if (entry->recent_focused) {
|
if (entry->recent_focused) {
|
||||||
entry->recent_focused = FALSE;
|
entry->recent_focused = false;
|
||||||
entry->select = entry->cursor;
|
entry->select = entry->cursor;
|
||||||
}
|
}
|
||||||
else if (msg->type == JM_BUTTONPRESSED)
|
else if (msg->type == JM_BUTTONPRESSED)
|
||||||
@ -430,24 +431,24 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
/* show the cursor */
|
/* show the cursor */
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
jmanager_start_timer(entry->timer_id);
|
jmanager_start_timer(entry->timer_id);
|
||||||
entry->state = TRUE;
|
entry->state = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_BUTTONRELEASED:
|
case JM_BUTTONRELEASED:
|
||||||
if (jwidget_has_capture(widget))
|
if (jwidget_has_capture(widget))
|
||||||
jwidget_release_mouse(widget);
|
jwidget_release_mouse(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_DOUBLECLICK:
|
case JM_DOUBLECLICK:
|
||||||
entry_forward_word(widget);
|
entry_forward_word(widget);
|
||||||
entry->select = entry->cursor;
|
entry->select = entry->cursor;
|
||||||
entry_backward_word(widget);
|
entry_backward_word(widget);
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_MOUSEENTER:
|
case JM_MOUSEENTER:
|
||||||
case JM_MOUSELEAVE:
|
case JM_MOUSELEAVE:
|
||||||
@ -457,7 +458,7 @@ static bool entry_msg_proc(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void entry_request_size(JWidget widget, int *w, int *h)
|
static void entry_request_size(JWidget widget, int *w, int *h)
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "jinete/jbase.h"
|
#include "jinete/jbase.h"
|
||||||
|
|
||||||
JWidget jentry_new(int maxsize, const char *format, ...);
|
JWidget jentry_new(size_t maxsize, const char *format, ...);
|
||||||
|
|
||||||
void jentry_readonly(JWidget entry, bool state);
|
void jentry_readonly(JWidget entry, bool state);
|
||||||
void jentry_password(JWidget entry, bool state);
|
void jentry_password(JWidget entry, bool state);
|
||||||
|
@ -149,8 +149,8 @@ char *ji_file_select_ex(const char *message,
|
|||||||
/* create input widget (entry_path) */
|
/* create input widget (entry_path) */
|
||||||
entry_path = NULL;
|
entry_path = NULL;
|
||||||
entry_name = NULL;
|
entry_name = NULL;
|
||||||
entry_path_created = FALSE;
|
entry_path_created = false;
|
||||||
entry_name_created = FALSE;
|
entry_name_created = false;
|
||||||
|
|
||||||
if (widget_extension) {
|
if (widget_extension) {
|
||||||
entry_path = jwidget_find_name(widget_extension, "path");
|
entry_path = jwidget_find_name(widget_extension, "path");
|
||||||
@ -159,12 +159,12 @@ char *ji_file_select_ex(const char *message,
|
|||||||
|
|
||||||
if (!entry_path) {
|
if (!entry_path) {
|
||||||
entry_path = jentry_new(size-1, NULL);
|
entry_path = jentry_new(size-1, NULL);
|
||||||
entry_path_created = TRUE;
|
entry_path_created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entry_name) {
|
if (!entry_name) {
|
||||||
entry_name = jentry_new(size-1, NULL);
|
entry_name = jentry_new(size-1, NULL);
|
||||||
entry_name_created = TRUE;
|
entry_name_created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add hook */
|
/* add hook */
|
||||||
@ -178,10 +178,10 @@ char *ji_file_select_ex(const char *message,
|
|||||||
jview_attach(view1, listbox1);
|
jview_attach(view1, listbox1);
|
||||||
jview_attach(view2, listbox2);
|
jview_attach(view2, listbox2);
|
||||||
|
|
||||||
jwidget_expansive(view1, TRUE);
|
jwidget_expansive(view1, true);
|
||||||
jwidget_expansive(view2, TRUE);
|
jwidget_expansive(view2, true);
|
||||||
jwidget_expansive(panel, TRUE);
|
jwidget_expansive(panel, true);
|
||||||
jwidget_expansive(box2, TRUE);
|
jwidget_expansive(box2, true);
|
||||||
|
|
||||||
if (widget_extension && (tmp = jwidget_find_name(widget_extension, "top")))
|
if (widget_extension && (tmp = jwidget_find_name(widget_extension, "top")))
|
||||||
jwidget_add_child(box1, tmp);
|
jwidget_add_child(box1, tmp);
|
||||||
@ -196,7 +196,7 @@ char *ji_file_select_ex(const char *message,
|
|||||||
else {
|
else {
|
||||||
JWidget subbox1 = jbox_new(JI_VERTICAL);
|
JWidget subbox1 = jbox_new(JI_VERTICAL);
|
||||||
JWidget subbox2 = jbox_new(JI_HORIZONTAL);
|
JWidget subbox2 = jbox_new(JI_HORIZONTAL);
|
||||||
jwidget_expansive(entry_name, TRUE);
|
jwidget_expansive(entry_name, true);
|
||||||
jwidget_add_child(box2, subbox1);
|
jwidget_add_child(box2, subbox1);
|
||||||
jwidget_add_child(subbox1, panel);
|
jwidget_add_child(subbox1, panel);
|
||||||
jwidget_add_child(subbox1, subbox2);
|
jwidget_add_child(subbox1, subbox2);
|
||||||
@ -215,7 +215,7 @@ char *ji_file_select_ex(const char *message,
|
|||||||
jwidget_add_child(window, box1);
|
jwidget_add_child(window, box1);
|
||||||
|
|
||||||
/* magnetic */
|
/* magnetic */
|
||||||
jwidget_magnetic(button_select, TRUE);
|
jwidget_magnetic(button_select, true);
|
||||||
|
|
||||||
/* setup window size */
|
/* setup window size */
|
||||||
jwidget_set_min_size(panel, JI_SCREEN_W*9/10, JI_SCREEN_H*3/5);
|
jwidget_set_min_size(panel, JI_SCREEN_W*9/10, JI_SCREEN_H*3/5);
|
||||||
@ -329,7 +329,7 @@ static bool filesel_msg_proc(JWidget widget, JMessage msg)
|
|||||||
case JI_SIGNAL_BUTTON_SELECT:
|
case JI_SIGNAL_BUTTON_SELECT:
|
||||||
if (!enter_to_path_in_entry())
|
if (!enter_to_path_in_entry())
|
||||||
jwidget_close_window(widget);
|
jwidget_close_window(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JI_SIGNAL_LISTBOX_SELECT: {
|
case JI_SIGNAL_LISTBOX_SELECT: {
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
@ -382,17 +382,17 @@ static bool filesel_msg_proc(JWidget widget, JMessage msg)
|
|||||||
(msg->key.scancode == KEY_ENTER_PAD))) {
|
(msg->key.scancode == KEY_ENTER_PAD))) {
|
||||||
if (enter_to_path_in_entry()) {
|
if (enter_to_path_in_entry()) {
|
||||||
jmanager_set_focus(widget);
|
jmanager_set_focus(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
jwidget_close_window(widget);
|
jwidget_close_window(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool enter_to_path_in_entry()
|
static bool enter_to_path_in_entry()
|
||||||
@ -456,10 +456,10 @@ static bool enter_to_path_in_entry()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* callback function for `for_each_file' routine */
|
/* callback function for `for_each_file' routine */
|
||||||
@ -476,7 +476,7 @@ static void fill_listbox_callback(const char* filename, int attrib, int param)
|
|||||||
/* all directories */
|
/* all directories */
|
||||||
if (attrib & FA_DIREC) {
|
if (attrib & FA_DIREC) {
|
||||||
list = &paths;
|
list = &paths;
|
||||||
found = TRUE;
|
found = true;
|
||||||
}
|
}
|
||||||
/* only files with an acceptable extension */
|
/* only files with an acceptable extension */
|
||||||
else {
|
else {
|
||||||
@ -628,7 +628,7 @@ static bool check_extension(const char *filename_ext)
|
|||||||
assert(extensions != NULL);
|
assert(extensions != NULL);
|
||||||
|
|
||||||
if (jlist_empty(extensions))
|
if (jlist_empty(extensions))
|
||||||
return TRUE; /* all extensions */
|
return true; /* all extensions */
|
||||||
|
|
||||||
len = ustrlen(filename_ext);
|
len = ustrlen(filename_ext);
|
||||||
|
|
||||||
@ -639,23 +639,23 @@ static bool check_extension(const char *filename_ext)
|
|||||||
|
|
||||||
case EQUAL_TO_TEXT:
|
case EQUAL_TO_TEXT:
|
||||||
if (ustricmp(ext->text, filename_ext) == 0)
|
if (ustricmp(ext->text, filename_ext) == 0)
|
||||||
return TRUE;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case START_WITH_TEXT:
|
case START_WITH_TEXT:
|
||||||
if (my_ustrnicmp(ext->text, filename_ext, ext->size) == 0)
|
if (my_ustrnicmp(ext->text, filename_ext, ext->size) == 0)
|
||||||
return TRUE;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case END_WITH_TEXT:
|
case END_WITH_TEXT:
|
||||||
if (len >= ext->size &&
|
if (len >= ext->size &&
|
||||||
my_ustrnicmp(ext->text, filename_ext+len-ext->size, ext->size) == 0)
|
my_ustrnicmp(ext->text, filename_ext+len-ext->size, ext->size) == 0)
|
||||||
return TRUE;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_extensions()
|
static void free_extensions()
|
||||||
|
@ -75,7 +75,7 @@ typedef struct FONT_AA_DATA {
|
|||||||
} FONT_AA_DATA;
|
} FONT_AA_DATA;
|
||||||
|
|
||||||
static FT_Library ft_library;
|
static FT_Library ft_library;
|
||||||
static bool ji_font_inited = FALSE;
|
static bool ji_font_inited = false;
|
||||||
|
|
||||||
extern FONT_VTABLE _ji_font_vtable_aa;
|
extern FONT_VTABLE _ji_font_vtable_aa;
|
||||||
extern FONT_VTABLE* ji_font_vtable_aa;
|
extern FONT_VTABLE* ji_font_vtable_aa;
|
||||||
@ -111,7 +111,7 @@ static void _font_uncache_glyphs(FONT* f)
|
|||||||
|
|
||||||
for (i=0; i<af->face->num_glyphs; i++) {
|
for (i=0; i<af->face->num_glyphs; i++) {
|
||||||
if (af->cached_glyphs[i].is_cached) {
|
if (af->cached_glyphs[i].is_cached) {
|
||||||
af->cached_glyphs[i].is_cached = FALSE;
|
af->cached_glyphs[i].is_cached = false;
|
||||||
if (af->cached_glyphs[i].bmp) {
|
if (af->cached_glyphs[i].bmp) {
|
||||||
jfree(af->cached_glyphs[i].bmp);
|
jfree(af->cached_glyphs[i].bmp);
|
||||||
af->cached_glyphs[i].bmp = NULL;
|
af->cached_glyphs[i].bmp = NULL;
|
||||||
@ -149,9 +149,9 @@ static void _font_cache_glyph(AL_CONST FONT* f, int glyph_number)
|
|||||||
FT_Get_Glyph(af->face->glyph, &new_glyph);
|
FT_Get_Glyph(af->face->glyph, &new_glyph);
|
||||||
|
|
||||||
/* ok, this glyph is now cached */
|
/* ok, this glyph is now cached */
|
||||||
af->cached_glyphs[glyph_number].is_cached = TRUE;
|
af->cached_glyphs[glyph_number].is_cached = true;
|
||||||
af->cached_glyphs[glyph_number].mono_available = FALSE;
|
af->cached_glyphs[glyph_number].mono_available = false;
|
||||||
af->cached_glyphs[glyph_number].aa_available = FALSE;
|
af->cached_glyphs[glyph_number].aa_available = false;
|
||||||
|
|
||||||
/* render the mono bmp */
|
/* render the mono bmp */
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ static void _font_cache_glyph(AL_CONST FONT* f, int glyph_number)
|
|||||||
/* save only if the bitmap is really 1 bit */
|
/* save only if the bitmap is really 1 bit */
|
||||||
if (ft_bmp->pixel_mode == ft_pixel_mode_mono) {
|
if (ft_bmp->pixel_mode == ft_pixel_mode_mono) {
|
||||||
|
|
||||||
af->cached_glyphs[glyph_number].mono_available = TRUE;
|
af->cached_glyphs[glyph_number].mono_available = true;
|
||||||
|
|
||||||
/* set width, height, left, top */
|
/* set width, height, left, top */
|
||||||
af->cached_glyphs[glyph_number].width = ft_bmp->width;
|
af->cached_glyphs[glyph_number].width = ft_bmp->width;
|
||||||
@ -235,7 +235,7 @@ static void _font_cache_glyph(AL_CONST FONT* f, int glyph_number)
|
|||||||
/* save only if the bitmap is really 8 bit */
|
/* save only if the bitmap is really 8 bit */
|
||||||
if (ft_bmp->pixel_mode == ft_pixel_mode_grays) {
|
if (ft_bmp->pixel_mode == ft_pixel_mode_grays) {
|
||||||
|
|
||||||
af->cached_glyphs[glyph_number].aa_available = TRUE;
|
af->cached_glyphs[glyph_number].aa_available = true;
|
||||||
|
|
||||||
/* set width, height, left, top */
|
/* set width, height, left, top */
|
||||||
af->cached_glyphs[glyph_number].aawidth = ft_bmp->width;
|
af->cached_glyphs[glyph_number].aawidth = ft_bmp->width;
|
||||||
@ -298,7 +298,7 @@ static void _font_new_cache_glyph(FONT* f)
|
|||||||
af->cached_glyphs = jnew(struct CACHED_GLYPH, af->face->num_glyphs);
|
af->cached_glyphs = jnew(struct CACHED_GLYPH, af->face->num_glyphs);
|
||||||
|
|
||||||
for (i=0; i<af->face->num_glyphs; i++) {
|
for (i=0; i<af->face->num_glyphs; i++) {
|
||||||
af->cached_glyphs[i].is_cached = FALSE;
|
af->cached_glyphs[i].is_cached = false;
|
||||||
af->cached_glyphs[i].bmp = NULL;
|
af->cached_glyphs[i].bmp = NULL;
|
||||||
af->cached_glyphs[i].aabmp = 0;
|
af->cached_glyphs[i].aabmp = 0;
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ int _ji_font_init()
|
|||||||
if (FT_Init_FreeType (&ft_library))
|
if (FT_Init_FreeType (&ft_library))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ji_font_inited = TRUE;
|
ji_font_inited = true;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ void _ji_font_exit()
|
|||||||
if (ji_font_inited) {
|
if (ji_font_inited) {
|
||||||
FT_Done_FreeType(ft_library);
|
FT_Done_FreeType(ft_library);
|
||||||
|
|
||||||
ji_font_inited = FALSE;
|
ji_font_inited = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ int ji_font_set_size(FONT* f, int h)
|
|||||||
|
|
||||||
/* check we arent at 0 */
|
/* check we arent at 0 */
|
||||||
if (test_h <= 0) {
|
if (test_h <= 0) {
|
||||||
error = TRUE;
|
error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,12 +529,12 @@ bool ji_font_is_fixed(FONT* f)
|
|||||||
FONT_AA_DATA* af = reinterpret_cast<FONT_AA_DATA*>(f->data);
|
FONT_AA_DATA* af = reinterpret_cast<FONT_AA_DATA*>(f->data);
|
||||||
|
|
||||||
if (af->num_fixed_sizes < 0)
|
if (af->num_fixed_sizes < 0)
|
||||||
return FALSE;
|
return false;
|
||||||
else
|
else
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ji_font_is_scalable(FONT* f)
|
bool ji_font_is_scalable(FONT* f)
|
||||||
@ -543,12 +543,12 @@ bool ji_font_is_scalable(FONT* f)
|
|||||||
FONT_AA_DATA* af = reinterpret_cast<FONT_AA_DATA*>(f->data);
|
FONT_AA_DATA* af = reinterpret_cast<FONT_AA_DATA*>(f->data);
|
||||||
|
|
||||||
if (af->num_fixed_sizes < 0)
|
if (af->num_fixed_sizes < 0)
|
||||||
return TRUE;
|
return true;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int *ji_font_get_available_fixed_sizes(FONT* f, int *n)
|
const int *ji_font_get_available_fixed_sizes(FONT* f, int *n)
|
||||||
@ -996,12 +996,12 @@ int ji_font_set_aa_mode(struct FONT* f, int mode)
|
|||||||
|
|
||||||
bool ji_font_is_fixed(FONT* f)
|
bool ji_font_is_fixed(FONT* f)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ji_font_is_scalable(FONT* f)
|
bool ji_font_is_scalable(FONT* f)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int *ji_font_get_available_fixed_sizes(FONT* f, int* n)
|
const int *ji_font_get_available_fixed_sizes(FONT* f, int* n)
|
||||||
|
@ -478,7 +478,7 @@ static void grid_distribute_size(JWidget widget, JRect rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DISTRIBUTE_SIZE(cols, colstrip, l, r, jrect_w, grid->same_width_columns);
|
DISTRIBUTE_SIZE(cols, colstrip, l, r, jrect_w, grid->same_width_columns);
|
||||||
DISTRIBUTE_SIZE(rows, rowstrip, t, b, jrect_h, FALSE);
|
DISTRIBUTE_SIZE(rows, rowstrip, t, b, jrect_h, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool grid_put_widget_in_cell(JWidget widget, JWidget child, int hspan, int vspan, int align)
|
static bool grid_put_widget_in_cell(JWidget widget, JWidget child, int hspan, int vspan, int align)
|
||||||
|
@ -66,7 +66,7 @@ static bool image_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
msg->reqsize.w = widget->border_width.l + jrect_w(&box) + widget->border_width.r;
|
msg->reqsize.w = widget->border_width.l + jrect_w(&box) + widget->border_width.r;
|
||||||
msg->reqsize.h = widget->border_width.t + jrect_h(&box) + widget->border_width.b;
|
msg->reqsize.h = widget->border_width.t + jrect_h(&box) + widget->border_width.b;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_DRAW: {
|
case JM_DRAW: {
|
||||||
@ -81,9 +81,9 @@ static bool image_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
blit(bmp, ji_screen, 0, 0,
|
blit(bmp, ji_screen, 0, 0,
|
||||||
icon.x1, icon.y1, jrect_w(&icon), jrect_h(&icon));
|
icon.x1, icon.y1, jrect_w(&icon), jrect_h(&icon));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ bool _ji_is_valid_widget(JWidget widget)
|
|||||||
|
|
||||||
void _ji_set_font_of_all_widgets(struct FONT *f)
|
void _ji_set_font_of_all_widgets(struct FONT *f)
|
||||||
{
|
{
|
||||||
int c;
|
size_t c;
|
||||||
|
|
||||||
// first of all, we have to set the font to all the widgets
|
// first of all, we have to set the font to all the widgets
|
||||||
for (c=0; c<widgets->size(); c++)
|
for (c=0; c<widgets->size(); c++)
|
||||||
|
@ -55,7 +55,7 @@ JWidget jlistbox_new()
|
|||||||
JWidget widget = jwidget_new(JI_LISTBOX);
|
JWidget widget = jwidget_new(JI_LISTBOX);
|
||||||
|
|
||||||
jwidget_add_hook(widget, JI_LISTBOX, listbox_msg_proc, NULL);
|
jwidget_add_hook(widget, JI_LISTBOX, listbox_msg_proc, NULL);
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_init_theme(widget);
|
jwidget_init_theme(widget);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
@ -170,15 +170,15 @@ static bool listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
listbox_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
listbox_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS:
|
case JM_SETPOS:
|
||||||
listbox_set_position(widget, &msg->setpos.rect);
|
listbox_set_position(widget, &msg->setpos.rect);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_DIRTYCHILDREN:
|
case JM_DIRTYCHILDREN:
|
||||||
listbox_dirty_children(widget);
|
listbox_dirty_children(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_OPEN:
|
case JM_OPEN:
|
||||||
jlistbox_center_scroll(widget);
|
jlistbox_center_scroll(widget);
|
||||||
@ -191,7 +191,7 @@ static bool listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (jwidget_has_capture(widget)) {
|
if (jwidget_has_capture(widget)) {
|
||||||
int select = jlistbox_get_selected_index(widget);
|
int select = jlistbox_get_selected_index(widget);
|
||||||
JWidget view = jwidget_get_view(widget);
|
JWidget view = jwidget_get_view(widget);
|
||||||
bool pick_item = TRUE;
|
bool pick_item = true;
|
||||||
|
|
||||||
if (view) {
|
if (view) {
|
||||||
JRect vp = jview_get_viewport_position(view);
|
JRect vp = jview_get_viewport_position(view);
|
||||||
@ -199,12 +199,12 @@ static bool listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (msg->mouse.y < vp->y1) {
|
if (msg->mouse.y < vp->y1) {
|
||||||
int num = MAX(1, (vp->y1 - msg->mouse.y) / 8);
|
int num = MAX(1, (vp->y1 - msg->mouse.y) / 8);
|
||||||
jlistbox_select_index(widget, select-num);
|
jlistbox_select_index(widget, select-num);
|
||||||
pick_item = FALSE;
|
pick_item = false;
|
||||||
}
|
}
|
||||||
else if (msg->mouse.y >= vp->y2) {
|
else if (msg->mouse.y >= vp->y2) {
|
||||||
int num = MAX(1, (msg->mouse.y - (vp->y2-1)) / 8);
|
int num = MAX(1, (msg->mouse.y - (vp->y2-1)) / 8);
|
||||||
jlistbox_select_index(widget, select+num);
|
jlistbox_select_index(widget, select+num);
|
||||||
pick_item = FALSE;
|
pick_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
jrect_free(vp);
|
jrect_free(vp);
|
||||||
@ -226,7 +226,7 @@ static bool listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jlistbox_select_child(widget, picked);
|
jlistbox_select_child(widget, picked);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -299,20 +299,20 @@ static bool listbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
jlistbox_select_index(widget, MID(0, select, bottom));
|
jlistbox_select_index(widget, MID(0, select, bottom));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_DOUBLECLICK:
|
case JM_DOUBLECLICK:
|
||||||
jwidget_emit_signal(widget, JI_SIGNAL_LISTBOX_SELECT);
|
jwidget_emit_signal(widget, JI_SIGNAL_LISTBOX_SELECT);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void listbox_request_size(JWidget widget, int *w, int *h)
|
static void listbox_request_size(JWidget widget, int *w, int *h)
|
||||||
@ -392,7 +392,7 @@ static bool listitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
listitem_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
listitem_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS: {
|
case JM_SETPOS: {
|
||||||
JRect crect;
|
JRect crect;
|
||||||
@ -405,11 +405,11 @@ static bool listitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_set_rect(reinterpret_cast<JWidget>(link->data), crect);
|
jwidget_set_rect(reinterpret_cast<JWidget>(link->data), crect);
|
||||||
|
|
||||||
jrect_free(crect);
|
jrect_free(crect);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void listitem_request_size(JWidget widget, int *w, int *h)
|
static void listitem_request_size(JWidget widget, int *w, int *h)
|
||||||
|
@ -103,7 +103,7 @@ static JWidget mouse_widget; /* the widget with the mouse */
|
|||||||
static JWidget capture_widget; /* the widget that captures the
|
static JWidget capture_widget; /* the widget that captures the
|
||||||
mouse */
|
mouse */
|
||||||
|
|
||||||
static bool first_time_poll; /* TRUE when we don't enter in poll yet */
|
static bool first_time_poll; /* true when we don't enter in poll yet */
|
||||||
|
|
||||||
static char old_readed_key[KEY_MAX]; /* keyboard status of previous
|
static char old_readed_key[KEY_MAX]; /* keyboard status of previous
|
||||||
poll */
|
poll */
|
||||||
@ -177,7 +177,7 @@ JWidget jmanager_new()
|
|||||||
mouse_widget = NULL;
|
mouse_widget = NULL;
|
||||||
capture_widget = NULL;
|
capture_widget = NULL;
|
||||||
|
|
||||||
first_time_poll = TRUE;
|
first_time_poll = true;
|
||||||
double_click_level = DOUBLE_CLICK_NONE;
|
double_click_level = DOUBLE_CLICK_NONE;
|
||||||
double_click_ticks = 0;
|
double_click_ticks = 0;
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ void jmanager_run(JWidget widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TRUE if there are messages in the queue to be distpatched
|
* @return true if there are messages in the queue to be distpatched
|
||||||
* through jmanager_dispatch_messages().
|
* through jmanager_dispatch_messages().
|
||||||
*/
|
*/
|
||||||
bool jmanager_generate_messages(JWidget manager)
|
bool jmanager_generate_messages(JWidget manager)
|
||||||
@ -281,7 +281,7 @@ bool jmanager_generate_messages(JWidget manager)
|
|||||||
poll_keyboard();
|
poll_keyboard();
|
||||||
|
|
||||||
if (first_time_poll) {
|
if (first_time_poll) {
|
||||||
first_time_poll = FALSE;
|
first_time_poll = false;
|
||||||
|
|
||||||
jmanager_refresh_screen();
|
jmanager_refresh_screen();
|
||||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||||
@ -289,11 +289,11 @@ bool jmanager_generate_messages(JWidget manager)
|
|||||||
|
|
||||||
/* first check: there are windows to manage? */
|
/* first check: there are windows to manage? */
|
||||||
if (jlist_empty(manager->children))
|
if (jlist_empty(manager->children))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
/* TODO check for STAGE */
|
/* TODO check for STAGE */
|
||||||
/* if (want_close_stage == STAGE_WANT_CLOSE) */
|
/* if (want_close_stage == STAGE_WANT_CLOSE) */
|
||||||
/* return FALSE; */
|
/* return false; */
|
||||||
|
|
||||||
/* new windows to show? */
|
/* new windows to show? */
|
||||||
if (!jlist_empty(new_windows)) {
|
if (!jlist_empty(new_windows)) {
|
||||||
@ -547,12 +547,12 @@ bool jmanager_generate_messages(JWidget manager)
|
|||||||
jwidget_flush_redraw(manager);
|
jwidget_flush_redraw(manager);
|
||||||
|
|
||||||
if (!jlist_empty(msg_queue))
|
if (!jlist_empty(msg_queue))
|
||||||
return TRUE;
|
return true;
|
||||||
else {
|
else {
|
||||||
/* make some OSes happy */
|
/* make some OSes happy */
|
||||||
yield_timeslice();
|
yield_timeslice();
|
||||||
rest(1);
|
rest(1);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,14 +715,14 @@ void jmanager_set_focus(JWidget widget)
|
|||||||
JMessage msg;
|
JMessage msg;
|
||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
widget_parents = jwidget_get_parents(widget, FALSE);
|
widget_parents = jwidget_get_parents(widget, false);
|
||||||
else
|
else
|
||||||
widget_parents = jlist_new();
|
widget_parents = jlist_new();
|
||||||
|
|
||||||
/* fetch the focus */
|
/* fetch the focus */
|
||||||
|
|
||||||
if (focus_widget) {
|
if (focus_widget) {
|
||||||
JList focus_parents = jwidget_get_parents(focus_widget, TRUE);
|
JList focus_parents = jwidget_get_parents(focus_widget, true);
|
||||||
msg = jmessage_new(JM_FOCUSLEAVE);
|
msg = jmessage_new(JM_FOCUSLEAVE);
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(focus_parents, link) {
|
JI_LIST_FOR_EACH(focus_parents, link) {
|
||||||
@ -786,14 +786,14 @@ void jmanager_set_mouse(JWidget widget)
|
|||||||
JMessage msg;
|
JMessage msg;
|
||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
widget_parents = jwidget_get_parents(widget, FALSE);
|
widget_parents = jwidget_get_parents(widget, false);
|
||||||
else
|
else
|
||||||
widget_parents = jlist_new();
|
widget_parents = jlist_new();
|
||||||
|
|
||||||
/* fetch the mouse */
|
/* fetch the mouse */
|
||||||
|
|
||||||
if (mouse_widget) {
|
if (mouse_widget) {
|
||||||
JList mouse_parents = jwidget_get_parents(mouse_widget, TRUE);
|
JList mouse_parents = jwidget_get_parents(mouse_widget, true);
|
||||||
msg = jmessage_new(JM_MOUSELEAVE);
|
msg = jmessage_new(JM_MOUSELEAVE);
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(mouse_parents, link) {
|
JI_LIST_FOR_EACH(mouse_parents, link) {
|
||||||
@ -865,7 +865,7 @@ void jmanager_focus_first_child(JWidget widget)
|
|||||||
JWidget it;
|
JWidget it;
|
||||||
|
|
||||||
for (it=jwidget_get_window(widget); it; it=next_widget(it)) {
|
for (it=jwidget_get_window(widget); it; it=next_widget(it)) {
|
||||||
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, TRUE))) {
|
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, true))) {
|
||||||
jmanager_set_focus(it);
|
jmanager_set_focus(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1015,7 +1015,7 @@ void _jmanager_close_window(JWidget manager, JWidget window, bool redraw_backgro
|
|||||||
jregion_union(reg1, reg1, reg2);
|
jregion_union(reg1, reg1, reg2);
|
||||||
jregion_free(reg2);
|
jregion_free(reg2);
|
||||||
|
|
||||||
_jmanager_close_window(manager, reinterpret_cast<JWidget>(link->data), FALSE);
|
_jmanager_close_window(manager, reinterpret_cast<JWidget>(link->data), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1069,30 +1069,30 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
|||||||
assert(msg->deffree.widget_to_free != widget);
|
assert(msg->deffree.widget_to_free != widget);
|
||||||
|
|
||||||
jwidget_free(msg->deffree.widget_to_free);
|
jwidget_free(msg->deffree.widget_to_free);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
manager_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
manager_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS:
|
case JM_SETPOS:
|
||||||
manager_set_position(widget, &msg->setpos.rect);
|
manager_set_position(widget, &msg->setpos.rect);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_DRAWRGN:
|
case JM_DRAWRGN:
|
||||||
manager_redraw_region(widget, msg->drawrgn.region);
|
manager_redraw_region(widget, msg->drawrgn.region);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_DRAW:
|
case JM_DRAW:
|
||||||
jdraw_rectfill(&msg->draw.rect, widget->theme->desktop_color);
|
jdraw_rectfill(&msg->draw.rect, widget->theme->desktop_color);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_KEYPRESSED:
|
case JM_KEYPRESSED:
|
||||||
case JM_KEYRELEASED: {
|
case JM_KEYRELEASED: {
|
||||||
JLink link, link2;
|
JLink link, link2;
|
||||||
|
|
||||||
msg->key.propagate_to_children = TRUE;
|
msg->key.propagate_to_children = true;
|
||||||
msg->key.propagate_to_parent = FALSE;
|
msg->key.propagate_to_parent = false;
|
||||||
|
|
||||||
/* continue sending the message to the children of all windows
|
/* continue sending the message to the children of all windows
|
||||||
(until a desktop or foreground window) */
|
(until a desktop or foreground window) */
|
||||||
@ -1102,7 +1102,7 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
|||||||
/* send to the window */
|
/* send to the window */
|
||||||
JI_LIST_FOR_EACH(w->children, link2)
|
JI_LIST_FOR_EACH(w->children, link2)
|
||||||
if (jwidget_send_message(reinterpret_cast<JWidget>(link2->data), msg))
|
if (jwidget_send_message(reinterpret_cast<JWidget>(link2->data), msg))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (jwindow_is_foreground(w) ||
|
if (jwindow_is_foreground(w) ||
|
||||||
jwindow_is_desktop(w))
|
jwindow_is_desktop(w))
|
||||||
@ -1113,12 +1113,12 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (msg->type == JM_KEYPRESSED)
|
if (msg->type == JM_KEYPRESSED)
|
||||||
move_focus(widget, msg);
|
move_focus(widget, msg);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void manager_request_size(JWidget widget, int *w, int *h)
|
static void manager_request_size(JWidget widget, int *w, int *h)
|
||||||
@ -1200,10 +1200,10 @@ static void manager_pump_queue(JWidget widget_manager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* this message is in use */
|
/* this message is in use */
|
||||||
msg->any.used = TRUE;
|
msg->any.used = true;
|
||||||
first_msg = msg;
|
first_msg = msg;
|
||||||
|
|
||||||
done = FALSE;
|
done = false;
|
||||||
JI_LIST_FOR_EACH(msg->any.widgets, link2) {
|
JI_LIST_FOR_EACH(msg->any.widgets, link2) {
|
||||||
widget = reinterpret_cast<JWidget>(link2->data);
|
widget = reinterpret_cast<JWidget>(link2->data);
|
||||||
|
|
||||||
@ -1400,12 +1400,12 @@ static void generate_proc_windows_list2(JWidget widget)
|
|||||||
static int some_parent_is_focusrest(JWidget widget)
|
static int some_parent_is_focusrest(JWidget widget)
|
||||||
{
|
{
|
||||||
if (jwidget_is_focusrest(widget))
|
if (jwidget_is_focusrest(widget))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (widget->parent)
|
if (widget->parent)
|
||||||
return some_parent_is_focusrest(widget->parent);
|
return some_parent_is_focusrest(widget->parent);
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JWidget find_magnetic_widget(JWidget widget)
|
static JWidget find_magnetic_widget(JWidget widget)
|
||||||
@ -1436,9 +1436,9 @@ static JMessage new_mouse_msg(int type, JWidget widget)
|
|||||||
msg->mouse.flags =
|
msg->mouse.flags =
|
||||||
type == JM_BUTTONRELEASED ? jmouse_b(1):
|
type == JM_BUTTONRELEASED ? jmouse_b(1):
|
||||||
jmouse_b(0);
|
jmouse_b(0);
|
||||||
msg->mouse.left = msg->mouse.flags & 1 ? TRUE: FALSE;
|
msg->mouse.left = msg->mouse.flags & 1 ? true: false;
|
||||||
msg->mouse.right = msg->mouse.flags & 2 ? TRUE: FALSE;
|
msg->mouse.right = msg->mouse.flags & 2 ? true: false;
|
||||||
msg->mouse.middle = msg->mouse.flags & 4 ? TRUE: FALSE;
|
msg->mouse.middle = msg->mouse.flags & 4 ? true: false;
|
||||||
|
|
||||||
if (widget != NULL)
|
if (widget != NULL)
|
||||||
jmessage_add_dest(msg, widget);
|
jmessage_add_dest(msg, widget);
|
||||||
@ -1488,7 +1488,7 @@ static bool move_focus(JWidget manager, JMessage msg)
|
|||||||
int (*cmp)(JWidget, int, int) = NULL;
|
int (*cmp)(JWidget, int, int) = NULL;
|
||||||
JWidget focus = NULL;
|
JWidget focus = NULL;
|
||||||
JWidget it, *list;
|
JWidget it, *list;
|
||||||
bool ret = FALSE;
|
bool ret = false;
|
||||||
JWidget window;
|
JWidget window;
|
||||||
int c, count;
|
int c, count;
|
||||||
|
|
||||||
@ -1514,12 +1514,12 @@ static bool move_focus(JWidget manager, JMessage msg)
|
|||||||
|
|
||||||
/* list's 1st element is the focused widget */
|
/* list's 1st element is the focused widget */
|
||||||
for (it=focus_widget; it; it=next_widget(it)) {
|
for (it=focus_widget; it; it=next_widget(it)) {
|
||||||
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, TRUE)))
|
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, true)))
|
||||||
list[c++] = it;
|
list[c++] = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (it=window; it != focus_widget; it=next_widget(it)) {
|
for (it=window; it != focus_widget; it=next_widget(it)) {
|
||||||
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, TRUE)))
|
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, true)))
|
||||||
list[c++] = it;
|
list[c++] = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1535,7 +1535,7 @@ static bool move_focus(JWidget manager, JMessage msg)
|
|||||||
else if (count > 1) {
|
else if (count > 1) {
|
||||||
focus = list[1];
|
focus = list[1];
|
||||||
}
|
}
|
||||||
ret = TRUE;
|
ret = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* arrow keys */
|
/* arrow keys */
|
||||||
@ -1579,7 +1579,7 @@ static bool move_focus(JWidget manager, JMessage msg)
|
|||||||
else
|
else
|
||||||
focus = list[0];
|
focus = list[0];
|
||||||
|
|
||||||
ret = TRUE;
|
ret = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1611,10 +1611,10 @@ static bool childs_accept_focus(JWidget widget, bool first)
|
|||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(widget->children, link)
|
JI_LIST_FOR_EACH(widget->children, link)
|
||||||
if (childs_accept_focus(reinterpret_cast<JWidget>(link->data), FALSE))
|
if (childs_accept_focus(reinterpret_cast<JWidget>(link->data), false))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
return first ? FALSE: ACCEPT_FOCUS(widget);
|
return first ? false: ACCEPT_FOCUS(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JWidget next_widget(JWidget widget)
|
static JWidget next_widget(JWidget widget)
|
||||||
|
@ -167,7 +167,7 @@ void _jmemleak_exit()
|
|||||||
line.SizeOfStruct = sizeof(IMAGEHLP_LINE);
|
line.SizeOfStruct = sizeof(IMAGEHLP_LINE);
|
||||||
|
|
||||||
HANDLE hproc = ::GetCurrentProcess();
|
HANDLE hproc = ::GetCurrentProcess();
|
||||||
::SymInitialize(hproc, NULL, FALSE);
|
::SymInitialize(hproc, NULL, false);
|
||||||
|
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
::GetModuleFileName(NULL, filename, sizeof filename);
|
::GetModuleFileName(NULL, filename, sizeof filename);
|
||||||
|
@ -185,7 +185,7 @@ JWidget jmenubox_new()
|
|||||||
menubox->base = NULL;
|
menubox->base = NULL;
|
||||||
|
|
||||||
jwidget_add_hook(widget, JI_MENUBOX, menubox_msg_proc, menubox);
|
jwidget_add_hook(widget, JI_MENUBOX, menubox_msg_proc, menubox);
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_init_theme(widget);
|
jwidget_init_theme(widget);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
@ -197,7 +197,7 @@ JWidget jmenuitem_new(const char *text)
|
|||||||
MenuItem *menuitem = jnew(MenuItem, 1);
|
MenuItem *menuitem = jnew(MenuItem, 1);
|
||||||
|
|
||||||
menuitem->accel = NULL;
|
menuitem->accel = NULL;
|
||||||
menuitem->highlight = FALSE;
|
menuitem->highlight = false;
|
||||||
menuitem->submenu = NULL;
|
menuitem->submenu = NULL;
|
||||||
menuitem->submenu_menubox = NULL;
|
menuitem->submenu_menubox = NULL;
|
||||||
|
|
||||||
@ -333,11 +333,11 @@ void jmenu_popup(JWidget menu, int x, int y)
|
|||||||
menubox = jmenubox_new();
|
menubox = jmenubox_new();
|
||||||
|
|
||||||
base = create_base(menubox);
|
base = create_base(menubox);
|
||||||
base->was_clicked = TRUE;
|
base->was_clicked = true;
|
||||||
base->is_filtering = TRUE;
|
base->is_filtering = true;
|
||||||
jmanager_add_msg_filter(JM_BUTTONPRESSED, menubox);
|
jmanager_add_msg_filter(JM_BUTTONPRESSED, menubox);
|
||||||
|
|
||||||
jwindow_moveable(window, FALSE); /* can't move the window */
|
jwindow_moveable(window, false); /* can't move the window */
|
||||||
|
|
||||||
/* set children */
|
/* set children */
|
||||||
jmenubox_set_menu(menubox, menu);
|
jmenubox_set_menu(menubox, menu);
|
||||||
@ -352,7 +352,7 @@ void jmenu_popup(JWidget menu, int x, int y)
|
|||||||
|
|
||||||
/* set the focus to the new menubox */
|
/* set the focus to the new menubox */
|
||||||
jmanager_set_focus(menubox);
|
jmanager_set_focus(menubox);
|
||||||
jwidget_magnetic(menubox, TRUE);
|
jwidget_magnetic(menubox, true);
|
||||||
|
|
||||||
/* open the window */
|
/* open the window */
|
||||||
jwindow_open_fg(window);
|
jwindow_open_fg(window);
|
||||||
@ -390,15 +390,15 @@ static bool menu_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
menu_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
menu_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS:
|
case JM_SETPOS:
|
||||||
menu_set_position(widget, &msg->setpos.rect);
|
menu_set_position(widget, &msg->setpos.rect);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_request_size(JWidget widget, int *w, int *h)
|
static void menu_request_size(JWidget widget, int *w, int *h)
|
||||||
@ -470,7 +470,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
if (menubox->base != NULL &&
|
if (menubox->base != NULL &&
|
||||||
menubox->base->is_filtering) {
|
menubox->base->is_filtering) {
|
||||||
menubox->base->is_filtering = FALSE;
|
menubox->base->is_filtering = false;
|
||||||
jmanager_remove_msg_filter(JM_BUTTONPRESSED, widget);
|
jmanager_remove_msg_filter(JM_BUTTONPRESSED, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,11 +483,11 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
menubox_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
menubox_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS:
|
case JM_SETPOS:
|
||||||
menubox_set_position(widget, &msg->setpos.rect);
|
menubox_set_position(widget, &msg->setpos.rect);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_MOTION:
|
case JM_MOTION:
|
||||||
/* isn't pressing a button? */
|
/* isn't pressing a button? */
|
||||||
@ -525,7 +525,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
/* the user click outside all the menu-box/menu-items, close all */
|
/* the user click outside all the menu-box/menu-items, close all */
|
||||||
close_all(menu);
|
close_all(menu);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if ((picked->type == JI_MENUITEM) &&
|
if ((picked->type == JI_MENUITEM) &&
|
||||||
!(picked->flags & JI_DISABLED) &&
|
!(picked->flags & JI_DISABLED) &&
|
||||||
!MITEM(picked)->highlight) {
|
!MITEM(picked)->highlight) {
|
||||||
set_highlight(menu, picked, FALSE, TRUE, FALSE);
|
set_highlight(menu, picked, false, true, false);
|
||||||
}
|
}
|
||||||
else if (!get_base(widget)->was_clicked) {
|
else if (!get_base(widget)->was_clicked) {
|
||||||
unhighlight(menu);
|
unhighlight(menu);
|
||||||
@ -579,15 +579,15 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (get_base(widget)->is_processing)
|
if (get_base(widget)->is_processing)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
get_base(widget)->was_clicked = FALSE;
|
get_base(widget)->was_clicked = false;
|
||||||
|
|
||||||
/* check for ALT+some letter in menubar and some letter in menuboxes */
|
/* check for ALT+some letter in menubar and some letter in menuboxes */
|
||||||
if (((widget->type == JI_MENUBOX) && (!msg->any.shifts)) ||
|
if (((widget->type == JI_MENUBOX) && (!msg->any.shifts)) ||
|
||||||
((widget->type == JI_MENUBAR) && (msg->any.shifts & KB_ALT_FLAG))) {
|
((widget->type == JI_MENUBAR) && (msg->any.shifts & KB_ALT_FLAG))) {
|
||||||
selected = check_for_letter(menu, scancode_to_ascii(msg->key.scancode));
|
selected = check_for_letter(menu, scancode_to_ascii(msg->key.scancode));
|
||||||
if (selected) {
|
if (selected) {
|
||||||
set_highlight(menu, selected, TRUE, TRUE, TRUE);
|
set_highlight(menu, selected, true, true, true);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +599,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (selected) {
|
if (selected) {
|
||||||
close_all(menu);
|
close_all(menu);
|
||||||
exe_menuitem(selected);
|
exe_menuitem(selected);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -610,7 +610,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
JWidget child;
|
JWidget child;
|
||||||
JWidget child_with_submenu_opened = NULL;
|
JWidget child_with_submenu_opened = NULL;
|
||||||
JLink link;
|
JLink link;
|
||||||
bool used = FALSE;
|
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) {
|
JI_LIST_FOR_EACH(menu->children, link) {
|
||||||
@ -636,20 +636,20 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
/* fetch the focus */
|
/* fetch the focus */
|
||||||
jmanager_free_focus();
|
jmanager_free_focus();
|
||||||
used = TRUE;
|
used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* in menu-boxes */
|
/* in menu-boxes */
|
||||||
else {
|
else {
|
||||||
if (child_with_submenu_opened) {
|
if (child_with_submenu_opened) {
|
||||||
close_menuitem(child_with_submenu_opened, TRUE);
|
close_menuitem(child_with_submenu_opened, true);
|
||||||
used = TRUE;
|
used = true;
|
||||||
}
|
}
|
||||||
/* go to parent */
|
/* go to parent */
|
||||||
else if (MENU(menu)->menuitem) {
|
else if (MENU(menu)->menuitem) {
|
||||||
/* just retrogress one parent-level */
|
/* just retrogress one parent-level */
|
||||||
close_menuitem(MENU(menu)->menuitem, TRUE);
|
close_menuitem(MENU(menu)->menuitem, true);
|
||||||
used = TRUE;
|
used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -658,30 +658,30 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
/* in menu-bar */
|
/* in menu-bar */
|
||||||
if (widget->type == JI_MENUBAR) {
|
if (widget->type == JI_MENUBAR) {
|
||||||
if (child_with_submenu_opened)
|
if (child_with_submenu_opened)
|
||||||
close_menuitem(child_with_submenu_opened, TRUE);
|
close_menuitem(child_with_submenu_opened, true);
|
||||||
}
|
}
|
||||||
/* in menu-boxes */
|
/* in menu-boxes */
|
||||||
else {
|
else {
|
||||||
/* go to previous */
|
/* go to previous */
|
||||||
highlight = find_previtem(menu, highlight);
|
highlight = find_previtem(menu, highlight);
|
||||||
set_highlight(menu, highlight, FALSE, FALSE, FALSE);
|
set_highlight(menu, highlight, false, false, false);
|
||||||
}
|
}
|
||||||
used = TRUE;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
/* in menu-bar */
|
/* in menu-bar */
|
||||||
if (widget->type == JI_MENUBAR) {
|
if (widget->type == JI_MENUBAR) {
|
||||||
/* select the active menu */
|
/* select the active menu */
|
||||||
set_highlight(menu, highlight, TRUE, TRUE, TRUE);
|
set_highlight(menu, highlight, true, true, true);
|
||||||
}
|
}
|
||||||
/* in menu-boxes */
|
/* in menu-boxes */
|
||||||
else {
|
else {
|
||||||
/* go to next */
|
/* go to next */
|
||||||
highlight = find_nextitem(menu, highlight);
|
highlight = find_nextitem(menu, highlight);
|
||||||
set_highlight(menu, highlight, FALSE, FALSE, FALSE);
|
set_highlight(menu, highlight, false, false, false);
|
||||||
}
|
}
|
||||||
used = TRUE;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_LEFT:
|
case KEY_LEFT:
|
||||||
@ -689,7 +689,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (widget->type == JI_MENUBAR) {
|
if (widget->type == JI_MENUBAR) {
|
||||||
/* go to previous */
|
/* go to previous */
|
||||||
highlight = find_previtem(menu, highlight);
|
highlight = find_previtem(menu, highlight);
|
||||||
set_highlight(menu, highlight, FALSE, FALSE, FALSE);
|
set_highlight(menu, highlight, false, false, false);
|
||||||
}
|
}
|
||||||
/* in menu-boxes */
|
/* in menu-boxes */
|
||||||
else {
|
else {
|
||||||
@ -706,16 +706,16 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
menuitem = find_previtem(menu, get_highlight(menu));
|
menuitem = find_previtem(menu, get_highlight(menu));
|
||||||
|
|
||||||
/* go to previous item in the parent */
|
/* go to previous item in the parent */
|
||||||
set_highlight(menu, menuitem, FALSE, TRUE, TRUE);
|
set_highlight(menu, menuitem, false, true, true);
|
||||||
}
|
}
|
||||||
/* if the parent isn't the menu-bar */
|
/* if the parent isn't the menu-bar */
|
||||||
else {
|
else {
|
||||||
/* just retrogress one parent-level */
|
/* just retrogress one parent-level */
|
||||||
close_menuitem(MENU(menu)->menuitem, TRUE);
|
close_menuitem(MENU(menu)->menuitem, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
used = TRUE;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
@ -723,13 +723,13 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (widget->type == JI_MENUBAR) {
|
if (widget->type == JI_MENUBAR) {
|
||||||
/* go to next */
|
/* go to next */
|
||||||
highlight = find_nextitem(menu, highlight);
|
highlight = find_nextitem(menu, highlight);
|
||||||
set_highlight(menu, highlight, FALSE, FALSE, FALSE);
|
set_highlight(menu, highlight, false, false, false);
|
||||||
}
|
}
|
||||||
/* in menu-boxes */
|
/* in menu-boxes */
|
||||||
else {
|
else {
|
||||||
/* enter in sub-menu */
|
/* enter in sub-menu */
|
||||||
if ((highlight) && HAS_SUBMENU(highlight)) {
|
if ((highlight) && HAS_SUBMENU(highlight)) {
|
||||||
set_highlight(menu, highlight, TRUE, TRUE, TRUE);
|
set_highlight(menu, highlight, true, true, true);
|
||||||
}
|
}
|
||||||
/* go to parent */
|
/* go to parent */
|
||||||
else if (MENU(menu)->menuitem) {
|
else if (MENU(menu)->menuitem) {
|
||||||
@ -743,17 +743,17 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
menuitem = find_nextitem(menu, get_highlight(menu));
|
menuitem = find_nextitem(menu, get_highlight(menu));
|
||||||
|
|
||||||
/* open the sub-menu */
|
/* open the sub-menu */
|
||||||
set_highlight(menu, menuitem, FALSE, TRUE, TRUE);
|
set_highlight(menu, menuitem, false, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
used = TRUE;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_ENTER:
|
case KEY_ENTER:
|
||||||
case KEY_ENTER_PAD:
|
case KEY_ENTER_PAD:
|
||||||
if (highlight)
|
if (highlight)
|
||||||
set_highlight(menu, highlight, TRUE, TRUE, TRUE);
|
set_highlight(menu, highlight, true, true, true);
|
||||||
used = TRUE;
|
used = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,13 +765,13 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
default:
|
default:
|
||||||
if (msg->type == JM_CLOSE_POPUP) {
|
if (msg->type == JM_CLOSE_POPUP) {
|
||||||
_jmanager_close_window(jwidget_get_manager(widget),
|
_jmanager_close_window(jwidget_get_manager(widget),
|
||||||
jwidget_get_window(widget), TRUE);
|
jwidget_get_window(widget), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menubox_request_size(JWidget widget, int *w, int *h)
|
static void menubox_request_size(JWidget widget, int *w, int *h)
|
||||||
@ -820,7 +820,7 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
menuitem_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
menuitem_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_MOUSEENTER:
|
case JM_MOUSEENTER:
|
||||||
case JM_MOUSELEAVE:
|
case JM_MOUSELEAVE:
|
||||||
@ -830,10 +830,10 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (msg->type == JM_OPEN_MENUITEM) {
|
if (msg->type == JM_OPEN_MENUITEM) {
|
||||||
Base *base = get_base(widget);
|
Base* base = get_base(widget);
|
||||||
JWidget window, menubox;
|
JWidget window, menubox;
|
||||||
JRect pos, old_pos;
|
JRect pos, old_pos;
|
||||||
bool select_first = msg->user.a;
|
bool select_first = (bool)msg->user.a;
|
||||||
|
|
||||||
assert(base != NULL);
|
assert(base != NULL);
|
||||||
assert(base->is_processing);
|
assert(base->is_processing);
|
||||||
@ -849,7 +849,7 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
menuitem->submenu_menubox = menubox;
|
menuitem->submenu_menubox = menubox;
|
||||||
|
|
||||||
jwindow_moveable(window, FALSE); /* can't move the window */
|
jwindow_moveable(window, false); /* can't move the window */
|
||||||
|
|
||||||
/* set children */
|
/* set children */
|
||||||
jmenubox_set_menu(menubox, menuitem->submenu);
|
jmenubox_set_menu(menubox, menuitem->submenu);
|
||||||
@ -906,7 +906,7 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jrect_free(pos);
|
jrect_free(pos);
|
||||||
|
|
||||||
/* set the focus to the new menubox */
|
/* set the focus to the new menubox */
|
||||||
jwidget_magnetic(menubox, TRUE);
|
jwidget_magnetic(menubox, true);
|
||||||
|
|
||||||
/* setup the highlight of the new menubox */
|
/* setup the highlight of the new menubox */
|
||||||
if (select_first) {
|
if (select_first) {
|
||||||
@ -927,7 +927,7 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (first_child)
|
if (first_child)
|
||||||
set_highlight(menuitem->submenu, first_child, FALSE, FALSE, FALSE);
|
set_highlight(menuitem->submenu, first_child, false, false, false);
|
||||||
else
|
else
|
||||||
unhighlight(menuitem->submenu);
|
unhighlight(menuitem->submenu);
|
||||||
}
|
}
|
||||||
@ -937,15 +937,15 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
/* run in background */
|
/* run in background */
|
||||||
jwindow_open_bg(window);
|
jwindow_open_bg(window);
|
||||||
|
|
||||||
base->is_processing = FALSE;
|
base->is_processing = false;
|
||||||
|
|
||||||
jrect_free(old_pos);
|
jrect_free(old_pos);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else if (msg->type == JM_CLOSE_MENUITEM) {
|
else if (msg->type == JM_CLOSE_MENUITEM) {
|
||||||
Base *base = get_base(widget);
|
Base* base = get_base(widget);
|
||||||
JWidget menubox, window;
|
JWidget menubox, window;
|
||||||
bool last_of_close_chain = msg->user.a;
|
bool last_of_close_chain = (bool)msg->user.a;
|
||||||
|
|
||||||
assert(base != NULL);
|
assert(base != NULL);
|
||||||
assert(base->is_processing);
|
assert(base->is_processing);
|
||||||
@ -976,21 +976,21 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (last_of_close_chain) {
|
if (last_of_close_chain) {
|
||||||
base->close_all = FALSE;
|
base->close_all = false;
|
||||||
base->is_processing = FALSE;
|
base->is_processing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else if (msg->type == JM_EXE_MENUITEM) {
|
else if (msg->type == JM_EXE_MENUITEM) {
|
||||||
jwidget_emit_signal(widget, JI_SIGNAL_MENUITEM_SELECT);
|
jwidget_emit_signal(widget, JI_SIGNAL_MENUITEM_SELECT);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menuitem_request_size(JWidget widget, int *w, int *h)
|
static void menuitem_request_size(JWidget widget, int *w, int *h)
|
||||||
@ -1053,7 +1053,7 @@ static JWidget get_base_menubox(JWidget widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(FALSE);
|
assert(false);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,10 +1067,10 @@ static Base *create_base(JWidget widget)
|
|||||||
{
|
{
|
||||||
Base *base = jnew(Base, 1);
|
Base *base = jnew(Base, 1);
|
||||||
|
|
||||||
base->was_clicked = FALSE;
|
base->was_clicked = false;
|
||||||
base->is_filtering = FALSE;
|
base->is_filtering = false;
|
||||||
base->is_processing = FALSE;
|
base->is_processing = false;
|
||||||
base->close_all = FALSE;
|
base->close_all = false;
|
||||||
|
|
||||||
MBOX(widget)->base = base;
|
MBOX(widget)->base = base;
|
||||||
|
|
||||||
@ -1110,7 +1110,7 @@ static void set_highlight(JWidget menu, JWidget menuitem, bool click, bool open_
|
|||||||
if (child != menuitem) {
|
if (child != menuitem) {
|
||||||
/* is it? */
|
/* is it? */
|
||||||
if (MITEM(child)->highlight) {
|
if (MITEM(child)->highlight) {
|
||||||
MITEM(child)->highlight = FALSE;
|
MITEM(child)->highlight = false;
|
||||||
jwidget_dirty(child);
|
jwidget_dirty(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1118,14 +1118,14 @@ static void set_highlight(JWidget menu, JWidget menuitem, bool click, bool open_
|
|||||||
|
|
||||||
if (menuitem) {
|
if (menuitem) {
|
||||||
if (!MITEM(menuitem)->highlight) {
|
if (!MITEM(menuitem)->highlight) {
|
||||||
MITEM(menuitem)->highlight = TRUE;
|
MITEM(menuitem)->highlight = true;
|
||||||
jwidget_dirty(menuitem);
|
jwidget_dirty(menuitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* highlight parents */
|
/* highlight parents */
|
||||||
if (MENU(menu)->menuitem != NULL) {
|
if (MENU(menu)->menuitem != NULL) {
|
||||||
set_highlight(MENU(menu)->menuitem->parent,
|
set_highlight(MENU(menu)->menuitem->parent,
|
||||||
MENU(menu)->menuitem, FALSE, FALSE, FALSE);
|
MENU(menu)->menuitem, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open submenu of the menitem */
|
/* open submenu of the menitem */
|
||||||
@ -1136,7 +1136,7 @@ static void set_highlight(JWidget menu, JWidget menuitem, bool click, bool open_
|
|||||||
open_menuitem(menuitem, select_first_child);
|
open_menuitem(menuitem, select_first_child);
|
||||||
|
|
||||||
/* the mouse was clicked */
|
/* the mouse was clicked */
|
||||||
get_base(menuitem)->was_clicked = TRUE;
|
get_base(menuitem)->was_clicked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* execute menuitem action */
|
/* execute menuitem action */
|
||||||
@ -1149,7 +1149,7 @@ static void set_highlight(JWidget menu, JWidget menuitem, bool click, bool open_
|
|||||||
|
|
||||||
static void unhighlight(JWidget menu)
|
static void unhighlight(JWidget menu)
|
||||||
{
|
{
|
||||||
set_highlight(menu, NULL, FALSE, FALSE, FALSE);
|
set_highlight(menu, NULL, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void open_menuitem(JWidget menuitem, bool select_first)
|
static void open_menuitem(JWidget menuitem, bool select_first)
|
||||||
@ -1179,7 +1179,7 @@ static void open_menuitem(JWidget menuitem, bool select_first)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (child != menuitem && MITEM(child)->submenu_menubox) {
|
if (child != menuitem && MITEM(child)->submenu_menubox) {
|
||||||
close_menuitem(child, FALSE);
|
close_menuitem(child, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1194,15 +1194,15 @@ static void open_menuitem(JWidget menuitem, bool select_first)
|
|||||||
assert(base != NULL);
|
assert(base != NULL);
|
||||||
|
|
||||||
/* reset flags */
|
/* reset flags */
|
||||||
base->close_all = FALSE;
|
base->close_all = false;
|
||||||
base->is_processing = TRUE;
|
base->is_processing = true;
|
||||||
|
|
||||||
/* we need to add a filter of the JM_BUTTONPRESSED to intercept
|
/* we need to add a filter of the JM_BUTTONPRESSED to intercept
|
||||||
clicks outside the menu (and close all the hierarchy in that
|
clicks outside the menu (and close all the hierarchy in that
|
||||||
case); the widget to intercept messages is the base menu-bar or
|
case); the widget to intercept messages is the base menu-bar or
|
||||||
popuped menu-box */
|
popuped menu-box */
|
||||||
if (!base->is_filtering) {
|
if (!base->is_filtering) {
|
||||||
base->is_filtering = TRUE;
|
base->is_filtering = true;
|
||||||
jmanager_add_msg_filter(JM_BUTTONPRESSED, get_base_menubox(menuitem));
|
jmanager_add_msg_filter(JM_BUTTONPRESSED, get_base_menubox(menuitem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1228,7 +1228,7 @@ static void close_menuitem(JWidget menuitem, bool last_of_close_chain)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (MITEM(child)->submenu_menubox) {
|
if (MITEM(child)->submenu_menubox) {
|
||||||
close_menuitem(reinterpret_cast<JWidget>(link->data), FALSE);
|
close_menuitem(reinterpret_cast<JWidget>(link->data), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1243,7 @@ static void close_menuitem(JWidget menuitem, bool last_of_close_chain)
|
|||||||
assert(base != NULL);
|
assert(base != NULL);
|
||||||
|
|
||||||
/* start processing */
|
/* start processing */
|
||||||
base->is_processing = TRUE;
|
base->is_processing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_popup(JWidget menubox)
|
static void close_popup(JWidget menubox)
|
||||||
@ -1269,10 +1269,10 @@ static void close_all(JWidget menu)
|
|||||||
|
|
||||||
base_menubox = get_base_menubox(menu->parent);
|
base_menubox = get_base_menubox(menu->parent);
|
||||||
base = MBOX(base_menubox)->base;
|
base = MBOX(base_menubox)->base;
|
||||||
base->close_all = TRUE;
|
base->close_all = true;
|
||||||
base->was_clicked = FALSE;
|
base->was_clicked = false;
|
||||||
if (base->is_filtering) {
|
if (base->is_filtering) {
|
||||||
base->is_filtering = FALSE;
|
base->is_filtering = false;
|
||||||
jmanager_remove_msg_filter(JM_BUTTONPRESSED, base_menubox);
|
jmanager_remove_msg_filter(JM_BUTTONPRESSED, base_menubox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1280,7 +1280,7 @@ static void close_all(JWidget menu)
|
|||||||
|
|
||||||
if (menuitem != NULL) {
|
if (menuitem != NULL) {
|
||||||
if (MITEM(menuitem)->submenu_menubox != NULL)
|
if (MITEM(menuitem)->submenu_menubox != NULL)
|
||||||
close_menuitem(menuitem, TRUE);
|
close_menuitem(menuitem, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JI_LIST_FOR_EACH(menu->children, link) {
|
JI_LIST_FOR_EACH(menu->children, link) {
|
||||||
@ -1290,7 +1290,7 @@ static void close_all(JWidget menu)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (MITEM(menuitem)->submenu_menubox != NULL)
|
if (MITEM(menuitem)->submenu_menubox != NULL)
|
||||||
close_menuitem(menuitem, TRUE);
|
close_menuitem(menuitem, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,7 +1318,7 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JWidget check_for_letter(JWidget menu, int ascii)
|
static JWidget check_for_letter(JWidget menu, int ascii)
|
||||||
|
@ -79,8 +79,8 @@ JMessage jmessage_new_key_related(int type, int readkey_value)
|
|||||||
msg->key.scancode = (readkey_value >> 8) & 0xff;
|
msg->key.scancode = (readkey_value >> 8) & 0xff;
|
||||||
msg->key.ascii = readkey_value & 0xff;
|
msg->key.ascii = readkey_value & 0xff;
|
||||||
msg->key.repeat = 0;
|
msg->key.repeat = 0;
|
||||||
msg->key.propagate_to_children = FALSE;
|
msg->key.propagate_to_children = false;
|
||||||
msg->key.propagate_to_parent = TRUE;
|
msg->key.propagate_to_parent = true;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("%i: %i %i [%c]\n", type, msg->key.scancode,
|
printf("%i: %i %i [%c]\n", type, msg->key.scancode,
|
||||||
@ -102,7 +102,7 @@ JMessage jmessage_new_copy(const JMessage msg)
|
|||||||
memcpy(copy, msg, sizeof(union jmessage));
|
memcpy(copy, msg, sizeof(union jmessage));
|
||||||
|
|
||||||
copy->any.widgets = jlist_copy(msg->any.widgets);
|
copy->any.widgets = jlist_copy(msg->any.widgets);
|
||||||
copy->any.used = FALSE;
|
copy->any.used = false;
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ JWidget jslider_new(int min, int max, int value)
|
|||||||
slider->value = MID(min, value, max);
|
slider->value = MID(min, value, max);
|
||||||
|
|
||||||
jwidget_add_hook(widget, JI_SLIDER, slider_msg_proc, slider);
|
jwidget_add_hook(widget, JI_SLIDER, slider_msg_proc, slider);
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_init_theme(widget);
|
jwidget_init_theme(widget);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
@ -124,7 +124,7 @@ static bool slider_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
slider_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
slider_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_FOCUSENTER:
|
case JM_FOCUSENTER:
|
||||||
case JM_FOCUSLEAVE:
|
case JM_FOCUSLEAVE:
|
||||||
@ -134,7 +134,7 @@ static bool slider_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_BUTTONPRESSED:
|
case JM_BUTTONPRESSED:
|
||||||
if (jwidget_is_disabled(widget))
|
if (jwidget_is_disabled(widget))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
jwidget_hard_capture_mouse(widget);
|
jwidget_hard_capture_mouse(widget);
|
||||||
@ -192,7 +192,7 @@ static bool slider_msg_proc(JWidget widget, JMessage msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jrect_free(rc);
|
jrect_free(rc);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ static bool slider_msg_proc(JWidget widget, JMessage msg)
|
|||||||
case KEY_HOME: value = min; break;
|
case KEY_HOME: value = min; break;
|
||||||
case KEY_END: value = max; break;
|
case KEY_END: value = max; break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slider->value != value) {
|
if (slider->value != value) {
|
||||||
@ -244,7 +244,7 @@ static bool slider_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_emit_signal(widget, JI_SIGNAL_SLIDER_CHANGE);
|
jwidget_emit_signal(widget, JI_SIGNAL_SLIDER_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -258,16 +258,16 @@ static bool slider_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jslider_set_value(widget, value);
|
jslider_set_value(widget, value);
|
||||||
jwidget_emit_signal(widget, JI_SIGNAL_SLIDER_CHANGE);
|
jwidget_emit_signal(widget, JI_SIGNAL_SLIDER_CHANGE);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_SETCURSOR:
|
case JM_SETCURSOR:
|
||||||
slider_setcursor(widget);
|
slider_setcursor(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void slider_request_size(JWidget widget, int *w, int *h)
|
static void slider_request_size(JWidget widget, int *w, int *h)
|
||||||
|
@ -121,7 +121,7 @@ int _ji_system_init()
|
|||||||
if (screen)
|
if (screen)
|
||||||
jmouse_poll();
|
jmouse_poll();
|
||||||
|
|
||||||
moved = TRUE;
|
moved = true;
|
||||||
m_cursor = JI_CURSOR_NULL;
|
m_cursor = JI_CURSOR_NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -355,7 +355,7 @@ bool jmouse_is_shown()
|
|||||||
/**
|
/**
|
||||||
* Updates the mouse information (position, wheel and buttons).
|
* Updates the mouse information (position, wheel and buttons).
|
||||||
*
|
*
|
||||||
* @return Returns TRUE if the mouse moved.
|
* @return Returns true if the mouse moved.
|
||||||
*/
|
*/
|
||||||
bool jmouse_poll()
|
bool jmouse_poll()
|
||||||
{
|
{
|
||||||
@ -374,20 +374,20 @@ bool jmouse_poll()
|
|||||||
if ((m_x[0] != m_x[1]) || (m_y[0] != m_y[1])) {
|
if ((m_x[0] != m_x[1]) || (m_y[0] != m_y[1])) {
|
||||||
poll_mouse();
|
poll_mouse();
|
||||||
update_mouse_position();
|
update_mouse_position();
|
||||||
moved = TRUE;
|
moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moved) {
|
if (moved) {
|
||||||
moved = FALSE;
|
moved = false;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jmouse_set_position(int x, int y)
|
void jmouse_set_position(int x, int y)
|
||||||
{
|
{
|
||||||
moved = TRUE;
|
moved = true;
|
||||||
|
|
||||||
m_x[0] = m_x[1] = x;
|
m_x[0] = m_x[1] = x;
|
||||||
m_y[0] = m_y[1] = y;
|
m_y[0] = m_y[1] = y;
|
||||||
@ -429,10 +429,10 @@ bool jmouse_control_infinite_scroll(JRect rect)
|
|||||||
|
|
||||||
if ((x != u) || (y != v)) {
|
if ((x != u) || (y != v)) {
|
||||||
jmouse_set_position(x, y);
|
jmouse_set_position(x, y);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_mouse_position()
|
static void update_mouse_position()
|
||||||
|
@ -52,7 +52,7 @@ JWidget jtextbox_new(const char *text, int align)
|
|||||||
JWidget widget = jwidget_new(JI_TEXTBOX);
|
JWidget widget = jwidget_new(JI_TEXTBOX);
|
||||||
|
|
||||||
jwidget_add_hook(widget, JI_TEXTBOX, textbox_msg_proc, NULL);
|
jwidget_add_hook(widget, JI_TEXTBOX, textbox_msg_proc, NULL);
|
||||||
jwidget_focusrest(widget, TRUE);
|
jwidget_focusrest(widget, true);
|
||||||
jwidget_set_align(widget, align);
|
jwidget_set_align(widget, align);
|
||||||
jwidget_set_text(widget, text);
|
jwidget_set_text(widget, text);
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
textbox_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
textbox_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SIGNAL:
|
case JM_SIGNAL:
|
||||||
if (msg->signal.num == JI_SIGNAL_SET_TEXT) {
|
if (msg->signal.num == JI_SIGNAL_SET_TEXT) {
|
||||||
@ -126,11 +126,11 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
jrect_free(vp);
|
jrect_free(vp);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
jrect_free(vp);
|
jrect_free(vp);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (view) {
|
if (view) {
|
||||||
jwidget_hard_capture_mouse(widget);
|
jwidget_hard_capture_mouse(widget);
|
||||||
jmouse_set_cursor(JI_CURSOR_SCROLL);
|
jmouse_set_cursor(JI_CURSOR_SCROLL);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (view && jwidget_has_capture(widget)) {
|
if (view && jwidget_has_capture(widget)) {
|
||||||
jwidget_release_mouse(widget);
|
jwidget_release_mouse(widget);
|
||||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void textbox_request_size(JWidget widget, int *w, int *h)
|
static void textbox_request_size(JWidget widget, int *w, int *h)
|
||||||
|
@ -381,7 +381,7 @@ void _ji_theme_textbox_draw(BITMAP *bmp, JWidget widget,
|
|||||||
else /* left */
|
else /* left */
|
||||||
xout = x;
|
xout = x;
|
||||||
|
|
||||||
draw_text(bmp, font, beg, xout, y, fg, bg, TRUE);
|
draw_text(bmp, font, beg, xout, y, fg, bg, true);
|
||||||
|
|
||||||
jrectexclude(bmp,
|
jrectexclude(bmp,
|
||||||
x1, y, x2, y+textheight-1,
|
x1, y, x2, y+textheight-1,
|
||||||
|
@ -76,7 +76,7 @@ void jwidget_add_tooltip_text(JWidget widget, const char *text)
|
|||||||
*/
|
*/
|
||||||
JWidget jtooltip_window_new(const char *text)
|
JWidget jtooltip_window_new(const char *text)
|
||||||
{
|
{
|
||||||
JWidget window = tipwindow_new(text, FALSE);
|
JWidget window = tipwindow_new(text, false);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ void jtooltip_window_set_hotregion(JWidget widget, JRegion region)
|
|||||||
jregion_free(tipwindow->hot_region);
|
jregion_free(tipwindow->hot_region);
|
||||||
|
|
||||||
if (!tipwindow->filtering) {
|
if (!tipwindow->filtering) {
|
||||||
tipwindow->filtering = TRUE;
|
tipwindow->filtering = true;
|
||||||
jmanager_add_msg_filter(JM_MOTION, widget);
|
jmanager_add_msg_filter(JM_MOTION, widget);
|
||||||
jmanager_add_msg_filter(JM_BUTTONPRESSED, widget);
|
jmanager_add_msg_filter(JM_BUTTONPRESSED, widget);
|
||||||
jmanager_add_msg_filter(JM_KEYPRESSED, widget);
|
jmanager_add_msg_filter(JM_KEYPRESSED, widget);
|
||||||
@ -153,7 +153,7 @@ static bool tip_hook(JWidget widget, JMessage msg)
|
|||||||
case JM_TIMER:
|
case JM_TIMER:
|
||||||
if (msg->timer.timer_id == tip->timer_id) {
|
if (msg->timer.timer_id == tip->timer_id) {
|
||||||
if (!tip->window) {
|
if (!tip->window) {
|
||||||
JWidget window = tipwindow_new(tip->text, TRUE);
|
JWidget window = tipwindow_new(tip->text, true);
|
||||||
/* int x = tip->widget->rc->x1; */
|
/* int x = tip->widget->rc->x1; */
|
||||||
/* int y = tip->widget->rc->y2; */
|
/* int y = tip->widget->rc->y2; */
|
||||||
int x = jmouse_x(0)+12;
|
int x = jmouse_x(0)+12;
|
||||||
@ -182,7 +182,7 @@ static bool tip_hook(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
@ -196,11 +196,11 @@ static JWidget tipwindow_new(const char *text, bool close_on_buttonpressed)
|
|||||||
|
|
||||||
tipwindow->close_on_buttonpressed = close_on_buttonpressed;
|
tipwindow->close_on_buttonpressed = close_on_buttonpressed;
|
||||||
tipwindow->hot_region = NULL;
|
tipwindow->hot_region = NULL;
|
||||||
tipwindow->filtering = FALSE;
|
tipwindow->filtering = false;
|
||||||
|
|
||||||
jwindow_sizeable(window, FALSE);
|
jwindow_sizeable(window, false);
|
||||||
jwindow_moveable(window, FALSE);
|
jwindow_moveable(window, false);
|
||||||
jwindow_wantfocus(window, FALSE);
|
jwindow_wantfocus(window, false);
|
||||||
|
|
||||||
jwidget_set_align(window, JI_LEFT | JI_TOP);
|
jwidget_set_align(window, JI_LEFT | JI_TOP);
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ static bool tipwindow_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_CLOSE:
|
case JM_CLOSE:
|
||||||
if (tipwindow->filtering) {
|
if (tipwindow->filtering) {
|
||||||
tipwindow->filtering = FALSE;
|
tipwindow->filtering = false;
|
||||||
jmanager_remove_msg_filter(JM_MOTION, widget);
|
jmanager_remove_msg_filter(JM_MOTION, widget);
|
||||||
jmanager_remove_msg_filter(JM_BUTTONPRESSED, widget);
|
jmanager_remove_msg_filter(JM_BUTTONPRESSED, widget);
|
||||||
jmanager_remove_msg_filter(JM_KEYPRESSED, widget);
|
jmanager_remove_msg_filter(JM_KEYPRESSED, widget);
|
||||||
@ -246,7 +246,7 @@ static bool tipwindow_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
case JM_DESTROY:
|
case JM_DESTROY:
|
||||||
if (tipwindow->filtering) {
|
if (tipwindow->filtering) {
|
||||||
tipwindow->filtering = FALSE;
|
tipwindow->filtering = false;
|
||||||
jmanager_remove_msg_filter(JM_MOTION, widget);
|
jmanager_remove_msg_filter(JM_MOTION, widget);
|
||||||
jmanager_remove_msg_filter(JM_BUTTONPRESSED, widget);
|
jmanager_remove_msg_filter(JM_BUTTONPRESSED, widget);
|
||||||
jmanager_remove_msg_filter(JM_KEYPRESSED, widget);
|
jmanager_remove_msg_filter(JM_KEYPRESSED, widget);
|
||||||
@ -285,7 +285,7 @@ static bool tipwindow_msg_proc(JWidget widget, JMessage msg)
|
|||||||
widget->border_width.l + max_w + widget->border_width.r);
|
widget->border_width.l + max_w + widget->border_width.r);
|
||||||
msg->reqsize.h += max_h;
|
msg->reqsize.h += max_h;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_SIGNAL:
|
case JM_SIGNAL:
|
||||||
@ -303,7 +303,7 @@ static bool tipwindow_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
/* setup the background color */
|
/* setup the background color */
|
||||||
jwidget_set_bg_color(widget, makecol(255, 255, 200));
|
jwidget_set_bg_color(widget, makecol(255, 255, 200));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -363,9 +363,9 @@ static bool tipwindow_msg_proc(JWidget widget, JMessage msg)
|
|||||||
widget->border_width.t = oldt;
|
widget->border_width.t = oldt;
|
||||||
|
|
||||||
jrect_free(pos);
|
jrect_free(pos);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ JWidget jview_new()
|
|||||||
view->viewport = viewport_new();
|
view->viewport = viewport_new();
|
||||||
view->scrollbar_h = scrollbar_new(JI_HORIZONTAL);
|
view->scrollbar_h = scrollbar_new(JI_HORIZONTAL);
|
||||||
view->scrollbar_v = scrollbar_new(JI_VERTICAL);
|
view->scrollbar_v = scrollbar_new(JI_VERTICAL);
|
||||||
view->hasbars = TRUE;
|
view->hasbars = true;
|
||||||
view->wherepos = 0;
|
view->wherepos = 0;
|
||||||
view->whereclick = 0;
|
view->whereclick = 0;
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ void jview_without_bars(JWidget widget)
|
|||||||
{
|
{
|
||||||
View* view = reinterpret_cast<View*>(jwidget_get_data(widget, JI_VIEW));
|
View* view = reinterpret_cast<View*>(jwidget_get_data(widget, JI_VIEW));
|
||||||
|
|
||||||
view->hasbars = FALSE;
|
view->hasbars = false;
|
||||||
|
|
||||||
jview_update(widget);
|
jview_update(widget);
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ static bool view_msg_proc(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JWidget viewport_new()
|
static JWidget viewport_new()
|
||||||
@ -489,7 +489,7 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
|||||||
View* view = reinterpret_cast<View*>(jwidget_get_data(widget->parent, JI_VIEW));
|
View* view = reinterpret_cast<View*>(jwidget_get_data(widget->parent, JI_VIEW));
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
int u1, v1, u2, v2;
|
int u1, v1, u2, v2;
|
||||||
int ret = FALSE;
|
bool ret = false;
|
||||||
int pos, len;
|
int pos, len;
|
||||||
|
|
||||||
jtheme_scrollbar_info(widget, &pos, &len);
|
jtheme_scrollbar_info(widget, &pos, &len);
|
||||||
@ -518,14 +518,14 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jview_set_scroll(widget->parent,
|
jview_set_scroll(widget->parent,
|
||||||
view->scroll_x - jrect_w(view->viewport->rc)/2,
|
view->scroll_x - jrect_w(view->viewport->rc)/2,
|
||||||
view->scroll_y);
|
view->scroll_y);
|
||||||
ret = TRUE;
|
ret = true;
|
||||||
}
|
}
|
||||||
/* right */
|
/* right */
|
||||||
else if (MOUSE_IN(u1+pos+len, y1, x2, y2)) {
|
else if (MOUSE_IN(u1+pos+len, y1, x2, y2)) {
|
||||||
jview_set_scroll(widget->parent,
|
jview_set_scroll(widget->parent,
|
||||||
view->scroll_x + jrect_w(view->viewport->rc)/2,
|
view->scroll_x + jrect_w(view->viewport->rc)/2,
|
||||||
view->scroll_y);
|
view->scroll_y);
|
||||||
ret = TRUE;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -538,14 +538,14 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jview_set_scroll(widget->parent,
|
jview_set_scroll(widget->parent,
|
||||||
view->scroll_x,
|
view->scroll_x,
|
||||||
view->scroll_y - jrect_h(view->viewport->rc)/2);
|
view->scroll_y - jrect_h(view->viewport->rc)/2);
|
||||||
ret = TRUE;
|
ret = true;
|
||||||
}
|
}
|
||||||
/* right */
|
/* right */
|
||||||
else if (MOUSE_IN(x1, v1+pos+len, x2, y2)) {
|
else if (MOUSE_IN(x1, v1+pos+len, x2, y2)) {
|
||||||
jview_set_scroll(widget->parent,
|
jview_set_scroll(widget->parent,
|
||||||
view->scroll_x,
|
view->scroll_x,
|
||||||
view->scroll_y + jrect_h(view->viewport->rc)/2);
|
view->scroll_y + jrect_h(view->viewport->rc)/2);
|
||||||
ret = TRUE;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,6 +554,8 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
jwidget_hard_capture_mouse(widget);
|
jwidget_hard_capture_mouse(widget);
|
||||||
|
|
||||||
|
// continue to JM_MOTION handler...
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_MOTION:
|
case JM_MOTION:
|
||||||
@ -601,7 +603,7 @@ static bool scrollbar_msg_proc(JWidget widget, JMessage msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scrollbar_info(JWidget widget, int *_pos, int *_len,
|
static void scrollbar_info(JWidget widget, int *_pos, int *_len,
|
||||||
|
@ -415,28 +415,28 @@ bool jwidget_is_magnetic(JWidget widget)
|
|||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_MAGNETIC) ? TRUE: FALSE;
|
return (widget->flags & JI_MAGNETIC) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_is_expansive(JWidget widget)
|
bool jwidget_is_expansive(JWidget widget)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_EXPANSIVE) ? TRUE: FALSE;
|
return (widget->flags & JI_EXPANSIVE) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_is_decorative(JWidget widget)
|
bool jwidget_is_decorative(JWidget widget)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_DECORATIVE) ? TRUE: FALSE;
|
return (widget->flags & JI_DECORATIVE) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_is_focusrest(JWidget widget)
|
bool jwidget_is_focusrest(JWidget widget)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_FOCUSREST) ? TRUE: FALSE;
|
return (widget->flags & JI_FOCUSREST) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@ -543,12 +543,12 @@ bool jwidget_is_hidden(JWidget widget)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (widget->flags & JI_HIDDEN)
|
if (widget->flags & JI_HIDDEN)
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
widget = widget->parent;
|
widget = widget->parent;
|
||||||
} while (widget);
|
} while (widget);
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_is_enabled(JWidget widget)
|
bool jwidget_is_enabled(JWidget widget)
|
||||||
@ -564,19 +564,19 @@ bool jwidget_is_disabled(JWidget widget)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (widget->flags & JI_DISABLED)
|
if (widget->flags & JI_DISABLED)
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
widget = widget->parent;
|
widget = widget->parent;
|
||||||
} while (widget);
|
} while (widget);
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_is_selected(JWidget widget)
|
bool jwidget_is_selected(JWidget widget)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_SELECTED) ? TRUE: FALSE;
|
return (widget->flags & JI_SELECTED) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_is_deselected(JWidget widget)
|
bool jwidget_is_deselected(JWidget widget)
|
||||||
@ -593,21 +593,21 @@ bool jwidget_has_focus(JWidget widget)
|
|||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_HASFOCUS) ? TRUE: FALSE;
|
return (widget->flags & JI_HASFOCUS) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_has_mouse(JWidget widget)
|
bool jwidget_has_mouse(JWidget widget)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_HASMOUSE) ? TRUE: FALSE;
|
return (widget->flags & JI_HASMOUSE) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwidget_has_capture(JWidget widget)
|
bool jwidget_has_capture(JWidget widget)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
return (widget->flags & JI_HASCAPTURE) ? TRUE: FALSE;
|
return (widget->flags & JI_HASCAPTURE) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@ -715,7 +715,7 @@ JWidget jwidget_get_manager(JWidget widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns a list of parents (you must free the list), if "ascendant"
|
/* returns a list of parents (you must free the list), if "ascendant"
|
||||||
is TRUE the list is build from child to parents, else the list is
|
is true the list is build from child to parents, else the list is
|
||||||
from parent to children */
|
from parent to children */
|
||||||
JList jwidget_get_parents(JWidget widget, bool ascendant)
|
JList jwidget_get_parents(JWidget widget, bool ascendant)
|
||||||
{
|
{
|
||||||
@ -771,7 +771,7 @@ bool jwidget_has_child(JWidget widget, JWidget child)
|
|||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
assert_valid_widget(child);
|
assert_valid_widget(child);
|
||||||
|
|
||||||
return jlist_find(widget->children, child) != widget->children->end ? TRUE: FALSE;
|
return jlist_find(widget->children, child) != widget->children->end ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@ -1303,13 +1303,13 @@ void jwidget_signal_off(JWidget widget)
|
|||||||
widget->emit_signals++;
|
widget->emit_signals++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jwidget_emit_signal(JWidget widget, int signal_num)
|
bool jwidget_emit_signal(JWidget widget, int signal_num)
|
||||||
{
|
{
|
||||||
assert_valid_widget(widget);
|
assert_valid_widget(widget);
|
||||||
|
|
||||||
if (!widget->emit_signals) {
|
if (!widget->emit_signals) {
|
||||||
JMessage msg;
|
JMessage msg;
|
||||||
int ret;
|
bool ret;
|
||||||
|
|
||||||
#ifdef REPORT_SIGNALS
|
#ifdef REPORT_SIGNALS
|
||||||
printf("Signal: %d (%d)\n", signal_num, widget->id);
|
printf("Signal: %d (%d)\n", signal_num, widget->id);
|
||||||
@ -1332,7 +1332,7 @@ int jwidget_emit_signal(JWidget widget, int signal_num)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@ -1347,7 +1347,7 @@ int jwidget_emit_signal(JWidget widget, int signal_num)
|
|||||||
|
|
||||||
bool jwidget_send_message(JWidget widget, JMessage msg)
|
bool jwidget_send_message(JWidget widget, JMessage msg)
|
||||||
{
|
{
|
||||||
bool done = FALSE;
|
bool done = false;
|
||||||
JHook hook;
|
JHook hook;
|
||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
@ -1364,8 +1364,8 @@ bool jwidget_send_message(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
bool jwidget_send_message_after_type(JWidget widget, JMessage msg, int type)
|
bool jwidget_send_message_after_type(JWidget widget, JMessage msg, int type)
|
||||||
{
|
{
|
||||||
bool done = FALSE;
|
bool done = false;
|
||||||
bool send = FALSE;
|
bool send = false;
|
||||||
JHook hook;
|
JHook hook;
|
||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
@ -1376,7 +1376,7 @@ bool jwidget_send_message_after_type(JWidget widget, JMessage msg, int type)
|
|||||||
hook = reinterpret_cast<JHook>(link->data);
|
hook = reinterpret_cast<JHook>(link->data);
|
||||||
|
|
||||||
if (hook->type == type) {
|
if (hook->type == type) {
|
||||||
send = TRUE;
|
send = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!send)
|
else if (!send)
|
||||||
@ -1493,7 +1493,7 @@ bool jwidget_check_underscored(JWidget widget, int scancode)
|
|||||||
else if (scancode >= KEY_A && scancode <= KEY_Z)
|
else if (scancode >= KEY_A && scancode <= KEY_Z)
|
||||||
ascii = 'a' + (scancode - KEY_A);
|
ascii = 'a' + (scancode - KEY_A);
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if (widget->has_text()) {
|
if (widget->has_text()) {
|
||||||
const char* text = widget->text();
|
const char* text = widget->text();
|
||||||
@ -1501,10 +1501,10 @@ bool jwidget_check_underscored(JWidget widget, int scancode)
|
|||||||
for (c=0; text[c]; c++)
|
for (c=0; text[c]; c++)
|
||||||
if ((text[c] == '&') && (text[c+1] != '&'))
|
if ((text[c] == '&') && (text[c+1] != '&'))
|
||||||
if (ascii == tolower(text[c+1]))
|
if (ascii == tolower(text[c+1]))
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@ -1531,14 +1531,14 @@ static bool widget_msg_proc(JWidget widget, JMessage msg)
|
|||||||
case JM_DRAW:
|
case JM_DRAW:
|
||||||
if (widget->draw_method) {
|
if (widget->draw_method) {
|
||||||
(*widget->draw_method)(widget, &msg->draw.rect);
|
(*widget->draw_method)(widget, &msg->draw.rect);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
msg->reqsize.w = widget->min_w;
|
msg->reqsize.w = widget->min_w;
|
||||||
msg->reqsize.h = widget->min_h;
|
msg->reqsize.h = widget->min_h;
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS: {
|
case JM_SETPOS: {
|
||||||
JRect cpos;
|
JRect cpos;
|
||||||
@ -1552,13 +1552,13 @@ static bool widget_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jwidget_set_rect(reinterpret_cast<JWidget>(link->data), cpos);
|
jwidget_set_rect(reinterpret_cast<JWidget>(link->data), cpos);
|
||||||
|
|
||||||
jrect_free(cpos);
|
jrect_free(cpos);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_DRAWRGN:
|
case JM_DRAWRGN:
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
int redraw = FALSE;
|
int redraw = false;
|
||||||
JRegion region2;
|
JRegion region2;
|
||||||
JMessage msg2;
|
JMessage msg2;
|
||||||
JRect rect;
|
JRect rect;
|
||||||
@ -1571,7 +1571,7 @@ static bool widget_msg_proc(JWidget widget, JMessage msg)
|
|||||||
(widget->rc->y <= rect->y+rect->h-1) &&
|
(widget->rc->y <= rect->y+rect->h-1) &&
|
||||||
(widget->rc->x+widget->rc->w-1 >= rect->x) &&
|
(widget->rc->x+widget->rc->w-1 >= rect->x) &&
|
||||||
(widget->rc->y+widget->rc->h-1 >= rect->y)) {
|
(widget->rc->y+widget->rc->h-1 >= rect->y)) {
|
||||||
redraw = TRUE;
|
redraw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1605,7 +1605,7 @@ static bool widget_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (!(widget->flags & JI_HIDDEN)) /* is visible? */
|
if (!(widget->flags & JI_HIDDEN)) /* is visible? */
|
||||||
jwidget_invalidate_region(widget, msg->drawrgn.region);
|
jwidget_invalidate_region(widget, msg->drawrgn.region);
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_DIRTYCHILDREN: {
|
case JM_DIRTYCHILDREN: {
|
||||||
JLink link;
|
JLink link;
|
||||||
@ -1613,7 +1613,7 @@ static bool widget_msg_proc(JWidget widget, JMessage msg)
|
|||||||
JI_LIST_FOR_EACH(widget->children, link)
|
JI_LIST_FOR_EACH(widget->children, link)
|
||||||
jwidget_dirty(reinterpret_cast<JWidget>(link->data));
|
jwidget_dirty(reinterpret_cast<JWidget>(link->data));
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JM_KEYPRESSED:
|
case JM_KEYPRESSED:
|
||||||
@ -1649,10 +1649,10 @@ static bool widget_msg_proc(JWidget widget, JMessage msg)
|
|||||||
return jwidget_send_message(widget->parent, msg);
|
return jwidget_send_message(widget->parent, msg);
|
||||||
else {
|
else {
|
||||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void jwidget_scroll(JWidget widget, JRegion region, int dx, int dy);
|
|||||||
void jwidget_signal_on(JWidget widget);
|
void jwidget_signal_on(JWidget widget);
|
||||||
void jwidget_signal_off(JWidget widget);
|
void jwidget_signal_off(JWidget widget);
|
||||||
|
|
||||||
int jwidget_emit_signal(JWidget widget, int signal_num);
|
bool jwidget_emit_signal(JWidget widget, int signal_num);
|
||||||
|
|
||||||
/* manager handler */
|
/* manager handler */
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ static JRect click_pos = NULL;
|
|||||||
static int press_x, press_y;
|
static int press_x, press_y;
|
||||||
static int window_action = WINDOW_NONE;
|
static int window_action = WINDOW_NONE;
|
||||||
|
|
||||||
static JWidget window_new(int desktop, const char *text);
|
static JWidget window_new(bool desktop, const char *text);
|
||||||
static bool window_msg_proc(JWidget widget, JMessage msg);
|
static bool window_msg_proc(JWidget widget, JMessage msg);
|
||||||
static void window_request_size(JWidget widget, int *w, int *h);
|
static void window_request_size(JWidget widget, int *w, int *h);
|
||||||
static void window_set_position(JWidget widget, JRect rect);
|
static void window_set_position(JWidget widget, JRect rect);
|
||||||
@ -76,17 +76,17 @@ static void displace_widgets(JWidget widget, int x, int y);
|
|||||||
|
|
||||||
bool _jwindow_is_moving()
|
bool _jwindow_is_moving()
|
||||||
{
|
{
|
||||||
return (window_action == WINDOW_MOVE) ? TRUE: FALSE;
|
return (window_action == WINDOW_MOVE) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JWidget jwindow_new(const char *text)
|
JWidget jwindow_new(const char *text)
|
||||||
{
|
{
|
||||||
return window_new(FALSE, text);
|
return window_new(false, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
JWidget jwindow_new_desktop()
|
JWidget jwindow_new_desktop()
|
||||||
{
|
{
|
||||||
return window_new(TRUE, NULL);
|
return window_new(true, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
JWidget jwindow_get_killer(JWidget widget)
|
JWidget jwindow_get_killer(JWidget widget)
|
||||||
@ -131,7 +131,7 @@ void jwindow_remap(JWidget widget)
|
|||||||
JRect rect;
|
JRect rect;
|
||||||
|
|
||||||
if (window->is_autoremap) {
|
if (window->is_autoremap) {
|
||||||
window->is_autoremap = FALSE;
|
window->is_autoremap = false;
|
||||||
jwidget_show(widget);
|
jwidget_show(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void jwindow_position(JWidget widget, int x, int y)
|
|||||||
|
|
||||||
void jwindow_move(JWidget widget, JRect rect)
|
void jwindow_move(JWidget widget, JRect rect)
|
||||||
{
|
{
|
||||||
move_window(widget, rect, TRUE);
|
move_window(widget, rect, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void jwindow_open(JWidget widget)
|
void jwindow_open(JWidget widget)
|
||||||
@ -205,14 +205,14 @@ void jwindow_open_fg(JWidget widget)
|
|||||||
jwindow_open(widget);
|
jwindow_open(widget);
|
||||||
manager = jwidget_get_manager(widget);
|
manager = jwidget_get_manager(widget);
|
||||||
|
|
||||||
window->is_foreground = TRUE;
|
window->is_foreground = true;
|
||||||
|
|
||||||
while (!(widget->flags & JI_HIDDEN)) {
|
while (!(widget->flags & JI_HIDDEN)) {
|
||||||
if (jmanager_generate_messages(manager))
|
if (jmanager_generate_messages(manager))
|
||||||
jmanager_dispatch_messages(manager);
|
jmanager_dispatch_messages(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->is_foreground = FALSE;
|
window->is_foreground = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jwindow_open_bg(JWidget widget)
|
void jwindow_open_bg(JWidget widget)
|
||||||
@ -226,7 +226,7 @@ void jwindow_close(JWidget widget, JWidget killer)
|
|||||||
|
|
||||||
window->killer = killer;
|
window->killer = killer;
|
||||||
|
|
||||||
_jmanager_close_window(jwidget_get_manager(widget), widget, TRUE);
|
_jmanager_close_window(jwidget_get_manager(widget), widget, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jwindow_is_toplevel(JWidget widget)
|
bool jwindow_is_toplevel(JWidget widget)
|
||||||
@ -267,7 +267,7 @@ bool jwindow_is_wantfocus(JWidget widget)
|
|||||||
return window->is_wantfocus;
|
return window->is_wantfocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JWidget window_new(int desktop, const char *text)
|
static JWidget window_new(bool desktop, const char *text)
|
||||||
{
|
{
|
||||||
JWidget widget = jwidget_new(JI_WINDOW);
|
JWidget widget = jwidget_new(JI_WINDOW);
|
||||||
Window *window = jnew(Window, 1);
|
Window *window = jnew(Window, 1);
|
||||||
@ -276,10 +276,10 @@ static JWidget window_new(int desktop, const char *text)
|
|||||||
window->is_desktop = desktop;
|
window->is_desktop = desktop;
|
||||||
window->is_moveable = !desktop;
|
window->is_moveable = !desktop;
|
||||||
window->is_sizeable = !desktop;
|
window->is_sizeable = !desktop;
|
||||||
window->is_ontop = FALSE;
|
window->is_ontop = false;
|
||||||
window->is_wantfocus = TRUE;
|
window->is_wantfocus = true;
|
||||||
window->is_foreground = FALSE;
|
window->is_foreground = false;
|
||||||
window->is_autoremap = TRUE;
|
window->is_autoremap = true;
|
||||||
|
|
||||||
jwidget_hide(widget);
|
jwidget_hide(widget);
|
||||||
jwidget_add_hook(widget, JI_WINDOW, window_msg_proc, window);
|
jwidget_add_hook(widget, JI_WINDOW, window_msg_proc, window);
|
||||||
@ -298,17 +298,17 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
switch (msg->type) {
|
switch (msg->type) {
|
||||||
|
|
||||||
case JM_DESTROY:
|
case JM_DESTROY:
|
||||||
_jmanager_close_window(jwidget_get_manager(widget), widget, FALSE);
|
_jmanager_close_window(jwidget_get_manager(widget), widget, false);
|
||||||
jfree(window);
|
jfree(window);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JM_REQSIZE:
|
case JM_REQSIZE:
|
||||||
window_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
window_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_SETPOS:
|
case JM_SETPOS:
|
||||||
window_set_position(widget, &msg->setpos.rect);
|
window_set_position(widget, &msg->setpos.rect);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case JM_OPEN:
|
case JM_OPEN:
|
||||||
window->killer = NULL;
|
window->killer = NULL;
|
||||||
@ -337,7 +337,7 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
jrect_copy(click_pos, widget->rc);
|
jrect_copy(click_pos, widget->rc);
|
||||||
|
|
||||||
jwidget_hard_capture_mouse(widget);
|
jwidget_hard_capture_mouse(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@ -354,7 +354,7 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
window_action = WINDOW_NONE;
|
window_action = WINDOW_NONE;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
JRect rect = jrect_new(x, y,
|
JRect rect = jrect_new(x, y,
|
||||||
x+jrect_w(widget->rc),
|
x+jrect_w(widget->rc),
|
||||||
y+jrect_h(widget->rc));
|
y+jrect_h(widget->rc));
|
||||||
move_window(widget, rect, TRUE);
|
move_window(widget, rect, true);
|
||||||
jrect_free(rect);
|
jrect_free(rect);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -406,7 +406,7 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
{
|
{
|
||||||
JRect rect = jrect_new(x, y, x+w, y+h);
|
JRect rect = jrect_new(x, y, x+w, y+h);
|
||||||
move_window(widget, rect, FALSE);
|
move_window(widget, rect, false);
|
||||||
jrect_free(rect);
|
jrect_free(rect);
|
||||||
|
|
||||||
jwidget_emit_signal(widget, JI_SIGNAL_WINDOW_RESIZE);
|
jwidget_emit_signal(widget, JI_SIGNAL_WINDOW_RESIZE);
|
||||||
@ -457,13 +457,13 @@ static bool window_msg_proc(JWidget widget, JMessage msg)
|
|||||||
cursor = JI_CURSOR_SIZE_B;
|
cursor = JI_CURSOR_SIZE_B;
|
||||||
|
|
||||||
jmouse_set_cursor(cursor);
|
jmouse_set_cursor(cursor);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_request_size(JWidget widget, int *w, int *h)
|
static void window_request_size(JWidget widget, int *w, int *h)
|
||||||
|
@ -576,7 +576,7 @@ static JXmlElem read_elem(char *elem_string)
|
|||||||
char *name_beg = s; /* here the name begins */
|
char *name_beg = s; /* here the name begins */
|
||||||
char *name;
|
char *name;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
bool translatable = FALSE;
|
bool translatable = false;
|
||||||
|
|
||||||
/* read the attribute-name */
|
/* read the attribute-name */
|
||||||
while (*s && !IS_BLANK(*s) && *s != '=')
|
while (*s && !IS_BLANK(*s) && *s != '=')
|
||||||
|
@ -68,28 +68,28 @@ static struct {
|
|||||||
bool mask : 1;
|
bool mask : 1;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
} icons_data[ICONS] = {
|
} icons_data[ICONS] = {
|
||||||
{ FALSE, default_theme_cnormal },
|
{ false, default_theme_cnormal },
|
||||||
{ FALSE, default_theme_cnoradd },
|
{ false, default_theme_cnoradd },
|
||||||
{ FALSE, default_theme_cforbidden },
|
{ false, default_theme_cforbidden },
|
||||||
{ FALSE, default_theme_chand },
|
{ false, default_theme_chand },
|
||||||
{ FALSE, default_theme_cscroll },
|
{ false, default_theme_cscroll },
|
||||||
{ FALSE, default_theme_cmove },
|
{ false, default_theme_cmove },
|
||||||
{ FALSE, default_theme_csizetl },
|
{ false, default_theme_csizetl },
|
||||||
{ FALSE, default_theme_csizet },
|
{ false, default_theme_csizet },
|
||||||
{ FALSE, default_theme_csizetr },
|
{ false, default_theme_csizetr },
|
||||||
{ FALSE, default_theme_csizel },
|
{ false, default_theme_csizel },
|
||||||
{ FALSE, default_theme_csizer },
|
{ false, default_theme_csizer },
|
||||||
{ FALSE, default_theme_csizebl },
|
{ false, default_theme_csizebl },
|
||||||
{ FALSE, default_theme_csizeb },
|
{ false, default_theme_csizeb },
|
||||||
{ FALSE, default_theme_csizebr },
|
{ false, default_theme_csizebr },
|
||||||
{ FALSE, default_theme_ceyedropper },
|
{ false, default_theme_ceyedropper },
|
||||||
{ FALSE, default_theme_ichecke },
|
{ false, default_theme_ichecke },
|
||||||
{ FALSE, default_theme_icheckm },
|
{ false, default_theme_icheckm },
|
||||||
{ FALSE, default_theme_iclose },
|
{ false, default_theme_iclose },
|
||||||
{ TRUE, default_theme_imenum },
|
{ true, default_theme_imenum },
|
||||||
{ FALSE, default_theme_iradioe },
|
{ false, default_theme_iradioe },
|
||||||
{ FALSE, default_theme_iradiom },
|
{ false, default_theme_iradiom },
|
||||||
{ FALSE, default_theme_icombobox },
|
{ false, default_theme_icombobox },
|
||||||
};
|
};
|
||||||
|
|
||||||
static BITMAP *icons_bitmap[ICONS];
|
static BITMAP *icons_bitmap[ICONS];
|
||||||
@ -431,7 +431,7 @@ static void theme_init_widget(JWidget widget)
|
|||||||
jbutton_set_bevel(button, 0, 0, 0, 0);
|
jbutton_set_bevel(button, 0, 0, 0, 0);
|
||||||
jwidget_add_hook(button, JI_WIDGET,
|
jwidget_add_hook(button, JI_WIDGET,
|
||||||
theme_button_msg_proc, NULL);
|
theme_button_msg_proc, NULL);
|
||||||
jwidget_decorative(button, TRUE);
|
jwidget_decorative(button, true);
|
||||||
jwidget_add_child(widget, button);
|
jwidget_add_child(widget, button);
|
||||||
jwidget_set_name(button, "theme_close_button");
|
jwidget_set_name(button, "theme_close_button");
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ static void theme_draw_button(JWidget widget, JRect clip)
|
|||||||
|
|
||||||
/* text */
|
/* text */
|
||||||
crect = jwidget_get_child_rect(widget);
|
crect = jwidget_get_child_rect(widget);
|
||||||
draw_textstring(NULL, fg, bg, FALSE, widget, crect, 1);
|
draw_textstring(NULL, fg, bg, false, widget, crect, 1);
|
||||||
jrect_free(crect);
|
jrect_free(crect);
|
||||||
|
|
||||||
/* icon */
|
/* icon */
|
||||||
@ -648,7 +648,7 @@ static void theme_draw_check(JWidget widget, JRect clip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* text */
|
/* text */
|
||||||
draw_textstring(NULL, -1, bg, FALSE, widget, &text, 0);
|
draw_textstring(NULL, -1, bg, false, widget, &text, 0);
|
||||||
|
|
||||||
/* icon */
|
/* icon */
|
||||||
draw_icons(icon.x1, icon.y1, widget, ICON_CHECK_EDGE);
|
draw_icons(icon.x1, icon.y1, widget, ICON_CHECK_EDGE);
|
||||||
@ -747,7 +747,7 @@ static void theme_draw_label(JWidget widget, JRect clip)
|
|||||||
|
|
||||||
jdraw_rectfill(widget->rc, bg);
|
jdraw_rectfill(widget->rc, bg);
|
||||||
|
|
||||||
draw_textstring(NULL, -1, bg, FALSE, widget, widget->rc, 0);
|
draw_textstring(NULL, -1, bg, false, widget, widget->rc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void theme_draw_listbox(JWidget widget, JRect clip)
|
static void theme_draw_listbox(JWidget widget, JRect clip)
|
||||||
@ -785,7 +785,7 @@ static void theme_draw_listitem(JWidget widget, JRect clip)
|
|||||||
|
|
||||||
if (widget->has_text()) {
|
if (widget->has_text()) {
|
||||||
/* text */
|
/* text */
|
||||||
jdraw_text(widget->font(), widget->text(), x, y, fg, bg, TRUE);
|
jdraw_text(widget->font(), widget->text(), x, y, fg, bg, true);
|
||||||
|
|
||||||
/* background */
|
/* background */
|
||||||
jrectexclude
|
jrectexclude
|
||||||
@ -871,7 +871,7 @@ static void theme_draw_menuitem(JWidget widget, JRect clip)
|
|||||||
pos = jwidget_get_rect(widget);
|
pos = jwidget_get_rect(widget);
|
||||||
if (!bar)
|
if (!bar)
|
||||||
jrect_displace(pos, widget->child_spacing/2, 0);
|
jrect_displace(pos, widget->child_spacing/2, 0);
|
||||||
draw_textstring(NULL, fg, bg, FALSE, widget, pos, 0);
|
draw_textstring(NULL, fg, bg, false, widget, pos, 0);
|
||||||
jrect_free(pos);
|
jrect_free(pos);
|
||||||
|
|
||||||
/* for menu-box */
|
/* for menu-box */
|
||||||
@ -911,7 +911,7 @@ static void theme_draw_menuitem(JWidget widget, JRect clip)
|
|||||||
jaccel_to_string(jmenuitem_get_accel(widget), buf);
|
jaccel_to_string(jmenuitem_get_accel(widget), buf);
|
||||||
|
|
||||||
widget->align(JI_RIGHT | JI_MIDDLE);
|
widget->align(JI_RIGHT | JI_MIDDLE);
|
||||||
draw_textstring(buf, fg, bg, FALSE, widget, pos, 0);
|
draw_textstring(buf, fg, bg, false, widget, pos, 0);
|
||||||
widget->align(old_align);
|
widget->align(old_align);
|
||||||
|
|
||||||
jrect_free(pos);
|
jrect_free(pos);
|
||||||
@ -998,7 +998,7 @@ static void theme_draw_radio(JWidget widget, JRect clip)
|
|||||||
COLOR_FOREGROUND);
|
COLOR_FOREGROUND);
|
||||||
|
|
||||||
/* text */
|
/* text */
|
||||||
draw_textstring(NULL, -1, bg, FALSE, widget, &text, 0);
|
draw_textstring(NULL, -1, bg, false, widget, &text, 0);
|
||||||
|
|
||||||
/* icon */
|
/* icon */
|
||||||
draw_icons(icon.x1, icon.y1, widget, ICON_RADIO_EDGE);
|
draw_icons(icon.x1, icon.y1, widget, ICON_RADIO_EDGE);
|
||||||
@ -1051,7 +1051,7 @@ static void theme_draw_separator(JWidget widget, JRect clip)
|
|||||||
if (widget->has_text()) {
|
if (widget->has_text()) {
|
||||||
int h = jwidget_get_text_height(widget);
|
int h = jwidget_get_text_height(widget);
|
||||||
struct jrect r = { x1+h/2, y1-h/2, x2+1-h, y2+1+h };
|
struct jrect r = { x1+h/2, y1-h/2, x2+1-h, y2+1+h };
|
||||||
draw_textstring(NULL, -1, BGCOLOR, FALSE, widget, &r, 0);
|
draw_textstring(NULL, -1, BGCOLOR, false, widget, &r, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,11 +1066,11 @@ static int my_add_clip_rect(BITMAP *bitmap, int x1, int y1, int x2, int y2)
|
|||||||
int v2 = MIN(y2, bitmap->cb-1);
|
int v2 = MIN(y2, bitmap->cb-1);
|
||||||
|
|
||||||
if (u1 > u2 || v1 > v2)
|
if (u1 > u2 || v1 > v2)
|
||||||
return FALSE;
|
return false;
|
||||||
else
|
else
|
||||||
set_clip(bitmap, u1, v1, u2, v2);
|
set_clip(bitmap, u1, v1, u2, v2);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1163,12 +1163,12 @@ static void theme_draw_slider(JWidget widget, JRect clip)
|
|||||||
if (my_add_clip_rect(ji_screen, x1, y1, x, y2))
|
if (my_add_clip_rect(ji_screen, x1, y1, x, y2))
|
||||||
draw_textstring(NULL, COLOR_BACKGROUND,
|
draw_textstring(NULL, COLOR_BACKGROUND,
|
||||||
jwidget_is_disabled(widget) ?
|
jwidget_is_disabled(widget) ?
|
||||||
bg: COLOR_SELECTED, FALSE, widget, r, 0);
|
bg: COLOR_SELECTED, false, widget, r, 0);
|
||||||
|
|
||||||
set_clip(ji_screen, cx1, cy1, cx2, cy2);
|
set_clip(ji_screen, cx1, cy1, cx2, cy2);
|
||||||
|
|
||||||
if (my_add_clip_rect(ji_screen, x+1, y1, x2, y2))
|
if (my_add_clip_rect(ji_screen, x+1, y1, x2, y2))
|
||||||
draw_textstring(NULL, COLOR_FOREGROUND, bg, FALSE, widget, r, 0);
|
draw_textstring(NULL, COLOR_FOREGROUND, bg, false, widget, r, 0);
|
||||||
|
|
||||||
set_clip(ji_screen, cx1, cy1, cx2, cy2);
|
set_clip(ji_screen, cx1, cy1, cx2, cy2);
|
||||||
|
|
||||||
@ -1300,7 +1300,7 @@ static void theme_draw_window(JWidget widget, JRect clip)
|
|||||||
jdraw_text(widget->font(), widget->text(),
|
jdraw_text(widget->font(), widget->text(),
|
||||||
cpos->x1,
|
cpos->x1,
|
||||||
pos->y1+jrect_h(pos)/2-text_height(widget->font())/2,
|
pos->y1+jrect_h(pos)/2-text_height(widget->font())/2,
|
||||||
COLOR_BACKGROUND, bg, FALSE);
|
COLOR_BACKGROUND, bg, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* desktop */
|
/* desktop */
|
||||||
@ -1380,7 +1380,7 @@ static void draw_textstring(const char *t, int fg_color, int bg_color,
|
|||||||
COLOR_BACKGROUND, bg_color, fill_bg);
|
COLOR_BACKGROUND, bg_color, fill_bg);
|
||||||
|
|
||||||
if (fill_bg)
|
if (fill_bg)
|
||||||
fill_bg = FALSE;
|
fill_bg = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
jdraw_text(widget->font(), t, x, y,
|
jdraw_text(widget->font(), t, x, y,
|
||||||
@ -1438,7 +1438,7 @@ static bool theme_button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
case JM_KEYPRESSED:
|
case JM_KEYPRESSED:
|
||||||
if (msg->key.scancode == KEY_ESC) {
|
if (msg->key.scancode == KEY_ESC) {
|
||||||
jwidget_select(widget);
|
jwidget_select(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1447,12 +1447,12 @@ static bool theme_button_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (jwidget_is_selected(widget)) {
|
if (jwidget_is_selected(widget)) {
|
||||||
jwidget_deselect(widget);
|
jwidget_deselect(widget);
|
||||||
jwidget_close_window(widget);
|
jwidget_close_window(widget);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ static void save_gui_config()
|
|||||||
set_config_int("GfxMode", "Width", SCREEN_W);
|
set_config_int("GfxMode", "Width", SCREEN_W);
|
||||||
set_config_int("GfxMode", "Height", SCREEN_H);
|
set_config_int("GfxMode", "Height", SCREEN_H);
|
||||||
set_config_int("GfxMode", "Depth", bitmap_color_depth(screen));
|
set_config_int("GfxMode", "Depth", bitmap_color_depth(screen));
|
||||||
set_config_bool("GfxMode", "FullScreen", gfx_driver->windowed ? FALSE: TRUE);
|
set_config_bool("GfxMode", "FullScreen", gfx_driver->windowed ? false: true);
|
||||||
set_config_int("GfxMode", "Scale", screen_scaling);
|
set_config_int("GfxMode", "Scale", screen_scaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ static bool onionskin;
|
|||||||
|
|
||||||
static color_t cursor_color;
|
static color_t cursor_color;
|
||||||
static int _cursor_color;
|
static int _cursor_color;
|
||||||
static int _cursor_mask;
|
static bool _cursor_mask;
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
/* INKS */
|
/* INKS */
|
||||||
|
@ -300,7 +300,7 @@ void layer_configure_as_background(Layer* layer)
|
|||||||
*/
|
*/
|
||||||
bool layer_is_image(const Layer* layer)
|
bool layer_is_image(const Layer* layer)
|
||||||
{
|
{
|
||||||
return (layer->type == GFXOBJ_LAYER_IMAGE) ? TRUE: FALSE;
|
return (layer->type == GFXOBJ_LAYER_IMAGE) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -308,7 +308,7 @@ bool layer_is_image(const Layer* layer)
|
|||||||
*/
|
*/
|
||||||
bool layer_is_set(const Layer* layer)
|
bool layer_is_set(const Layer* layer)
|
||||||
{
|
{
|
||||||
return (layer->type == GFXOBJ_LAYER_SET) ? TRUE: FALSE;
|
return (layer->type == GFXOBJ_LAYER_SET) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -513,7 +513,7 @@ static bool has_cels(const Layer* layer, int frame)
|
|||||||
switch (layer->type) {
|
switch (layer->type) {
|
||||||
|
|
||||||
case GFXOBJ_LAYER_IMAGE:
|
case GFXOBJ_LAYER_IMAGE:
|
||||||
return layer_get_cel(layer, frame) ? TRUE: FALSE;
|
return layer_get_cel(layer, frame) ? true: false;
|
||||||
|
|
||||||
case GFXOBJ_LAYER_SET: {
|
case GFXOBJ_LAYER_SET: {
|
||||||
JLink link;
|
JLink link;
|
||||||
|
@ -335,7 +335,7 @@ Palette* palette_load(const char *filename)
|
|||||||
|
|
||||||
bool palette_save(Palette* pal, const char *filename)
|
bool palette_save(Palette* pal, const char *filename)
|
||||||
{
|
{
|
||||||
bool ret = FALSE;
|
bool success = false;
|
||||||
char ext[64];
|
char ext[64];
|
||||||
|
|
||||||
ustrcpy(ext, get_extension(filename));
|
ustrcpy(ext, get_extension(filename));
|
||||||
@ -354,14 +354,14 @@ bool palette_save(Palette* pal, const char *filename)
|
|||||||
|
|
||||||
palette_to_allegro(pal, rgbpal);
|
palette_to_allegro(pal, rgbpal);
|
||||||
|
|
||||||
ret = save_bitmap(filename, bmp, rgbpal);
|
success = (save_bitmap(filename, bmp, rgbpal) == 0);
|
||||||
destroy_bitmap(bmp);
|
destroy_bitmap(bmp);
|
||||||
}
|
}
|
||||||
else if (ustricmp(ext, "col") == 0) {
|
else if (ustricmp(ext, "col") == 0) {
|
||||||
ret = save_col_file(pal, filename);
|
success = save_col_file(pal, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
@ -32,12 +32,12 @@ class Palette;
|
|||||||
|
|
||||||
Image* image_set_imgtype(Image* image, int imgtype,
|
Image* image_set_imgtype(Image* image, int imgtype,
|
||||||
int dithering_method,
|
int dithering_method,
|
||||||
RGB_MAP *rgb_map,
|
RGB_MAP* rgb_map,
|
||||||
struct Palette *palette);
|
Palette* palette);
|
||||||
|
|
||||||
Image* image_rgb_to_indexed(Image* src_image,
|
Image* image_rgb_to_indexed(Image* src_image,
|
||||||
int offsetx, int offsety,
|
int offsetx, int offsety,
|
||||||
RGB_MAP *rgb_map,
|
RGB_MAP* rgb_map,
|
||||||
struct Palette *palette);
|
Palette* palette);
|
||||||
|
|
||||||
#endif /* RASTER_QUANT_H */
|
#endif /* RASTER_QUANT_H */
|
||||||
|
@ -282,7 +282,7 @@ bool sprite_is_modified(const Sprite* sprite)
|
|||||||
assert(sprite != NULL);
|
assert(sprite != NULL);
|
||||||
|
|
||||||
return (sprite->undo->diff_count ==
|
return (sprite->undo->diff_count ==
|
||||||
sprite->undo->diff_saved) ? FALSE: TRUE;
|
sprite->undo->diff_saved) ? false: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sprite_is_associated_to_file(const Sprite* sprite)
|
bool sprite_is_associated_to_file(const Sprite* sprite)
|
||||||
|
@ -758,7 +758,7 @@ static void chunk_flip_new(UndoStream* stream, Image* image, int x1, int y1, int
|
|||||||
chunk->y1 = y1;
|
chunk->y1 = y1;
|
||||||
chunk->x2 = x2;
|
chunk->x2 = x2;
|
||||||
chunk->y2 = y2;
|
chunk->y2 = y2;
|
||||||
chunk->horz = horz;
|
chunk->horz = horz ? 1: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chunk_flip_invert(UndoStream* stream, UndoChunkFlip* chunk, int state)
|
static void chunk_flip_invert(UndoStream* stream, UndoChunkFlip* chunk, int state)
|
||||||
@ -772,7 +772,7 @@ static void chunk_flip_invert(UndoStream* stream, UndoChunkFlip* chunk, int stat
|
|||||||
int y1 = chunk->y1;
|
int y1 = chunk->y1;
|
||||||
int x2 = chunk->x2;
|
int x2 = chunk->x2;
|
||||||
int y2 = chunk->y2;
|
int y2 = chunk->y2;
|
||||||
bool horz = chunk->horz;
|
bool horz = (chunk->horz != 0);
|
||||||
|
|
||||||
chunk_flip_new(stream, image, x1, y1, x2, y2, horz);
|
chunk_flip_new(stream, image, x1, y1, x2, y2, horz);
|
||||||
|
|
||||||
@ -1907,7 +1907,7 @@ static Layer* read_raw_layer(ase_uint8* raw_data)
|
|||||||
/* read cels */
|
/* read cels */
|
||||||
for (c=0; c<cels; c++) {
|
for (c=0; c<cels; c++) {
|
||||||
Cel* cel;
|
Cel* cel;
|
||||||
bool has_image;
|
ase_uint8 has_image;
|
||||||
|
|
||||||
/* read the cel */
|
/* read the cel */
|
||||||
cel = read_raw_cel(raw_data);
|
cel = read_raw_cel(raw_data);
|
||||||
@ -1918,7 +1918,7 @@ static Layer* read_raw_layer(ase_uint8* raw_data)
|
|||||||
|
|
||||||
/* read the image */
|
/* read the image */
|
||||||
read_raw_uint8(has_image);
|
read_raw_uint8(has_image);
|
||||||
if (has_image) {
|
if (has_image != 0) {
|
||||||
Image* image = read_raw_image(raw_data);
|
Image* image = read_raw_image(raw_data);
|
||||||
raw_data += get_raw_image_size(image);
|
raw_data += get_raw_image_size(image);
|
||||||
|
|
||||||
|
@ -57,6 +57,10 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_valid() const {
|
||||||
|
return m_sprite != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
operator Sprite* () { return m_sprite; }
|
operator Sprite* () { return m_sprite; }
|
||||||
operator const Sprite* () const { return m_sprite; }
|
operator const Sprite* () const { return m_sprite; }
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static void make_horiz_segs (gint start,
|
|||||||
gint scanline,
|
gint scanline,
|
||||||
gint empty[],
|
gint empty[],
|
||||||
gint num_empty,
|
gint num_empty,
|
||||||
gint top);
|
gboolean top);
|
||||||
static void generate_boundary (PixelRegion *PR,
|
static void generate_boundary (PixelRegion *PR,
|
||||||
BoundaryType type,
|
BoundaryType type,
|
||||||
gint x1,
|
gint x1,
|
||||||
@ -306,7 +306,7 @@ make_horiz_segs (gint start,
|
|||||||
gint scanline,
|
gint scanline,
|
||||||
gint empty[],
|
gint empty[],
|
||||||
gint num_empty,
|
gint num_empty,
|
||||||
gint top)
|
gboolean top)
|
||||||
{
|
{
|
||||||
gint empty_index;
|
gint empty_index;
|
||||||
gint e_s, e_e; /* empty segment start and end values */
|
gint e_s, e_e; /* empty segment start and end values */
|
||||||
@ -383,9 +383,9 @@ generate_boundary (PixelRegion *PR,
|
|||||||
for (i = 1; i < num_empty_c - 1; i += 2)
|
for (i = 1; i < num_empty_c - 1; i += 2)
|
||||||
{
|
{
|
||||||
make_horiz_segs (empty_segs_c [i], empty_segs_c [i+1],
|
make_horiz_segs (empty_segs_c [i], empty_segs_c [i+1],
|
||||||
scanline, empty_segs_l, num_empty_l, 1);
|
scanline, empty_segs_l, num_empty_l, true);
|
||||||
make_horiz_segs (empty_segs_c [i], empty_segs_c [i+1],
|
make_horiz_segs (empty_segs_c [i], empty_segs_c [i+1],
|
||||||
scanline+1, empty_segs_n, num_empty_n, 0);
|
scanline+1, empty_segs_n, num_empty_n, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the next scanline of empty segments, swap others */
|
/* get the next scanline of empty segments, swap others */
|
||||||
|
@ -43,9 +43,9 @@ typedef struct _BoundSeg
|
|||||||
unsigned visited : 1;
|
unsigned visited : 1;
|
||||||
} BoundSeg;
|
} BoundSeg;
|
||||||
|
|
||||||
BoundSeg *find_mask_boundary(const struct Image *maskPR, int *num_elems,
|
BoundSeg* find_mask_boundary(const Image* maskPR, int* num_elems,
|
||||||
BoundaryType type, int x1, int y1, int x2, int y2);
|
BoundaryType type, int x1, int y1, int x2, int y2);
|
||||||
BoundSeg *sort_boundary(BoundSeg *segs, int num_segs, int *num_groups);
|
BoundSeg* sort_boundary(BoundSeg* segs, int num_segs, int* num_groups);
|
||||||
|
|
||||||
void boundary_exit();
|
void boundary_exit();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
static bool win32_clipboard_contains_bitmap()
|
static bool win32_clipboard_contains_bitmap()
|
||||||
{
|
{
|
||||||
return IsClipboardFormatAvailable(CF_DIB);
|
return IsClipboardFormatAvailable(CF_DIB) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,19 +104,16 @@ Palette *load_col_file(const char *filename)
|
|||||||
/* saves an Animator Pro COL file */
|
/* saves an Animator Pro COL file */
|
||||||
bool save_col_file(Palette *pal, const char *filename)
|
bool save_col_file(Palette *pal, const char *filename)
|
||||||
{
|
{
|
||||||
ase_uint32 c;
|
FILE *f = fopen(filename, "wb");
|
||||||
FILE *f;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
f = fopen(filename, "wb");
|
|
||||||
if (!f)
|
if (!f)
|
||||||
return -1;
|
return false;
|
||||||
|
|
||||||
fputl(8+768, f); /* file size */
|
fputl(8+768, f); /* file size */
|
||||||
fputw(PROCOL_MAGIC_NUMBER, f); /* file format identifier */
|
fputw(PROCOL_MAGIC_NUMBER, f); /* file format identifier */
|
||||||
fputw(0, f); /* version file */
|
fputw(0, f); /* version file */
|
||||||
|
|
||||||
for (i=0; i<MAX_PALETTE_COLORS; i++) {
|
ase_uint32 c;
|
||||||
|
for (int i=0; i<MAX_PALETTE_COLORS; i++) {
|
||||||
c = palette_get_entry(pal, i);
|
c = palette_get_entry(pal, i);
|
||||||
|
|
||||||
fputc(_rgba_getr(c), f);
|
fputc(_rgba_getr(c), f);
|
||||||
@ -127,5 +124,5 @@ bool save_col_file(Palette *pal, const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,9 @@
|
|||||||
#ifndef UTIL_COL_FILE_H
|
#ifndef UTIL_COL_FILE_H
|
||||||
#define UTIL_COL_FILE_H
|
#define UTIL_COL_FILE_H
|
||||||
|
|
||||||
struct Palette;
|
class Palette;
|
||||||
|
|
||||||
struct Palette *load_col_file(const char *filename);
|
Palette* load_col_file(const char* filename);
|
||||||
bool save_col_file(struct Palette *pal, const char *filename);
|
bool save_col_file(Palette* pal, const char* filename);
|
||||||
|
|
||||||
#endif /* UTIL_COL_FILE_H */
|
|
||||||
|
|
||||||
|
#endif // UTIL_COL_FILE_H
|
||||||
|
@ -42,7 +42,7 @@ static BITMAP *old_bmp;
|
|||||||
|
|
||||||
bool is_rec_screen()
|
bool is_rec_screen()
|
||||||
{
|
{
|
||||||
return rec_file ? TRUE: FALSE;
|
return rec_file ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rec_screen_on()
|
void rec_screen_on()
|
||||||
|
@ -283,7 +283,7 @@ Image *render_sprite(Sprite *sprite,
|
|||||||
{
|
{
|
||||||
void (*zoomed_func)(Image *, Image *, int, int, int, int, int);
|
void (*zoomed_func)(Image *, Image *, int, int, int, int, int);
|
||||||
Layer *background = sprite_get_background_layer(sprite);
|
Layer *background = sprite_get_background_layer(sprite);
|
||||||
bool need_grid = (background != NULL ? !layer_is_readable(background): TRUE);
|
bool need_grid = (background != NULL ? !layer_is_readable(background): true);
|
||||||
int depth;
|
int depth;
|
||||||
Image *image;
|
Image *image;
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ static bool colorbar_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (sprite != NULL)
|
if (sprite != NULL)
|
||||||
update_editors_with_sprite(sprite);
|
update_editors_with_sprite(sprite);
|
||||||
}
|
}
|
||||||
catch (locked_sprite_exception& e) {
|
catch (locked_sprite_exception&) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ enum {
|
|||||||
EDIT_DRAWING,
|
EDIT_DRAWING,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int use_dither = FALSE;
|
static bool use_dither = false;
|
||||||
|
|
||||||
static bool editor_view_msg_proc(JWidget widget, JMessage msg);
|
static bool editor_view_msg_proc(JWidget widget, JMessage msg);
|
||||||
static bool editor_msg_proc(JWidget widget, JMessage msg);
|
static bool editor_msg_proc(JWidget widget, JMessage msg);
|
||||||
|
@ -744,8 +744,6 @@ static bool fileview_generate_thumbnail(JWidget widget, FileItem *fileitem)
|
|||||||
|
|
||||||
static void fileview_stop_threads(FileView* fileview)
|
static void fileview_stop_threads(FileView* fileview)
|
||||||
{
|
{
|
||||||
JLink link, next;
|
|
||||||
|
|
||||||
// stop the generation of threads
|
// stop the generation of threads
|
||||||
jmanager_stop_timer(fileview->timer_id);
|
jmanager_stop_timer(fileview->timer_id);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "jinete/jbase.h"
|
#include "jinete/jbase.h"
|
||||||
|
|
||||||
struct Palette;
|
class Palette;
|
||||||
|
|
||||||
/* TODO use some JI_SIGNAL_USER */
|
/* TODO use some JI_SIGNAL_USER */
|
||||||
#define SIGNAL_PALETTE_EDITOR_CHANGE 0x10005
|
#define SIGNAL_PALETTE_EDITOR_CHANGE 0x10005
|
||||||
@ -34,10 +34,10 @@ enum {
|
|||||||
PALETTE_EDITOR_RANGE_RECTANGULAR,
|
PALETTE_EDITOR_RANGE_RECTANGULAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
JWidget paledit_new(struct Palette *palette, bool editable, int boxsize);
|
JWidget paledit_new(Palette* palette, bool editable, int boxsize);
|
||||||
int paledit_type();
|
int paledit_type();
|
||||||
|
|
||||||
struct Palette *paledit_get_palette(JWidget widget);
|
Palette* paledit_get_palette(JWidget widget);
|
||||||
int paledit_get_range_type(JWidget widget);
|
int paledit_get_range_type(JWidget widget);
|
||||||
|
|
||||||
int paledit_get_columns(JWidget widget);
|
int paledit_get_columns(JWidget widget);
|
||||||
@ -53,4 +53,4 @@ int paledit_get_1st_color(JWidget widget);
|
|||||||
int paledit_get_2nd_color(JWidget widget);
|
int paledit_get_2nd_color(JWidget widget);
|
||||||
void paledit_get_selected_entries(JWidget widget, bool array[256]);
|
void paledit_get_selected_entries(JWidget widget, bool array[256]);
|
||||||
|
|
||||||
#endif /* WIDGETS_PALEDIT_H */
|
#endif // WIDGETS_PALEDIT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user