Display the selection-mode in the statusbar.

Restoring saved sessions works again.


--Sven
This commit is contained in:
Sven Neumann
1998-07-22 23:55:43 +00:00
parent 7934b3e065
commit 6b01e79246
6 changed files with 80 additions and 31 deletions

View File

@ -1,3 +1,8 @@
Thu Jul 23 01:53:09 MEST 1998 Sven Neumann <sven@gimp.org>
* app/rect_select.c: Display the selection-mode in the statusbar.
* app/session.c: Restoring saved sessions works again.
Wed Jul 22 23:32:50 MEST 1998 Sven Neumann <sven@gimp.org> Wed Jul 22 23:32:50 MEST 1998 Sven Neumann <sven@gimp.org>
* docs/quick_reference.ps * docs/quick_reference.ps

View File

@ -54,8 +54,8 @@
#include "session.h" #include "session.h"
static void sessionrc_write_info (SessionInfo *, FILE *); static void sessionrc_write_info (SessionInfo *, FILE *);
static void session_open_dialog (gpointer unused, gpointer pinfo); static void session_open_dialog (SessionInfo *);
static void session_reset_open_state (SessionInfo *info); static void session_reset_open_state (SessionInfo *);
GList *session_info_updates = NULL; GList *session_info_updates = NULL;
@ -198,10 +198,8 @@ sessionrc_write_info (SessionInfo *info, FILE *fp)
} }
static void static void
session_open_dialog (gpointer unused, gpointer pinfo) session_open_dialog (SessionInfo *info)
{ {
SessionInfo *info = (SessionInfo*) pinfo;
if (info == NULL || info->open == FALSE) if (info == NULL || info->open == FALSE)
return; return;

View File

@ -315,7 +315,7 @@ rect_select_button_press (Tool *tool,
{ {
GDisplay * gdisp; GDisplay * gdisp;
RectSelect * rect_sel; RectSelect * rect_sel;
gchar *size; gchar *select_mode;
int x, y; int x, y;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -380,11 +380,27 @@ rect_select_button_press (Tool *tool,
} }
rect_sel->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(gdisp->statusbar), rect_sel->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(gdisp->statusbar),
"selection"); "selection");
size = g_new (gchar, 24); /* strlen("Selection: x ") + 2*5 */ select_mode = g_new (gchar, 21); /* strlen("Selection: INTERSECT") */
sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h)); switch (rect_sel->op)
{
case ADD:
sprintf (select_mode, "Selection: ADD");
break;
case SUB:
sprintf (select_mode, "Selection: SUBTRACT");
break;
case INTERSECT:
sprintf (select_mode, "Selection: INTERSECT");
break;
case REPLACE:
sprintf (select_mode, "Selection: REPLACE");
break;
default:
break;
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar),
rect_sel->context_id, size); rect_sel->context_id, select_mode);
g_free (size); g_free (select_mode);
draw_core_start (rect_sel->core, gdisp->canvas->window, tool); draw_core_start (rect_sel->core, gdisp->canvas->window, tool);
} }
@ -576,7 +592,7 @@ rect_select_motion (Tool *tool,
} }
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar),
rect_sel->context_id); rect_sel->context_id);
size = g_new (gchar, 24); /* strlen("Selection: x ") + 2*5 */ size = g_new (gchar, 25); /* strlen("Selection: x ") + 2*5 */
sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h)); sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h));
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar),
rect_sel->context_id, size); rect_sel->context_id, size);

View File

@ -54,8 +54,8 @@
#include "session.h" #include "session.h"
static void sessionrc_write_info (SessionInfo *, FILE *); static void sessionrc_write_info (SessionInfo *, FILE *);
static void session_open_dialog (gpointer unused, gpointer pinfo); static void session_open_dialog (SessionInfo *);
static void session_reset_open_state (SessionInfo *info); static void session_reset_open_state (SessionInfo *);
GList *session_info_updates = NULL; GList *session_info_updates = NULL;
@ -198,10 +198,8 @@ sessionrc_write_info (SessionInfo *info, FILE *fp)
} }
static void static void
session_open_dialog (gpointer unused, gpointer pinfo) session_open_dialog (SessionInfo *info)
{ {
SessionInfo *info = (SessionInfo*) pinfo;
if (info == NULL || info->open == FALSE) if (info == NULL || info->open == FALSE)
return; return;

View File

@ -315,7 +315,7 @@ rect_select_button_press (Tool *tool,
{ {
GDisplay * gdisp; GDisplay * gdisp;
RectSelect * rect_sel; RectSelect * rect_sel;
gchar *size; gchar *select_mode;
int x, y; int x, y;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -380,11 +380,27 @@ rect_select_button_press (Tool *tool,
} }
rect_sel->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(gdisp->statusbar), rect_sel->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(gdisp->statusbar),
"selection"); "selection");
size = g_new (gchar, 24); /* strlen("Selection: x ") + 2*5 */ select_mode = g_new (gchar, 21); /* strlen("Selection: INTERSECT") */
sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h)); switch (rect_sel->op)
{
case ADD:
sprintf (select_mode, "Selection: ADD");
break;
case SUB:
sprintf (select_mode, "Selection: SUBTRACT");
break;
case INTERSECT:
sprintf (select_mode, "Selection: INTERSECT");
break;
case REPLACE:
sprintf (select_mode, "Selection: REPLACE");
break;
default:
break;
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar),
rect_sel->context_id, size); rect_sel->context_id, select_mode);
g_free (size); g_free (select_mode);
draw_core_start (rect_sel->core, gdisp->canvas->window, tool); draw_core_start (rect_sel->core, gdisp->canvas->window, tool);
} }
@ -576,7 +592,7 @@ rect_select_motion (Tool *tool,
} }
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar),
rect_sel->context_id); rect_sel->context_id);
size = g_new (gchar, 24); /* strlen("Selection: x ") + 2*5 */ size = g_new (gchar, 25); /* strlen("Selection: x ") + 2*5 */
sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h)); sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h));
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar),
rect_sel->context_id, size); rect_sel->context_id, size);

View File

@ -315,7 +315,7 @@ rect_select_button_press (Tool *tool,
{ {
GDisplay * gdisp; GDisplay * gdisp;
RectSelect * rect_sel; RectSelect * rect_sel;
gchar *size; gchar *select_mode;
int x, y; int x, y;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -380,11 +380,27 @@ rect_select_button_press (Tool *tool,
} }
rect_sel->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(gdisp->statusbar), rect_sel->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(gdisp->statusbar),
"selection"); "selection");
size = g_new (gchar, 24); /* strlen("Selection: x ") + 2*5 */ select_mode = g_new (gchar, 21); /* strlen("Selection: INTERSECT") */
sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h)); switch (rect_sel->op)
{
case ADD:
sprintf (select_mode, "Selection: ADD");
break;
case SUB:
sprintf (select_mode, "Selection: SUBTRACT");
break;
case INTERSECT:
sprintf (select_mode, "Selection: INTERSECT");
break;
case REPLACE:
sprintf (select_mode, "Selection: REPLACE");
break;
default:
break;
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar),
rect_sel->context_id, size); rect_sel->context_id, select_mode);
g_free (size); g_free (select_mode);
draw_core_start (rect_sel->core, gdisp->canvas->window, tool); draw_core_start (rect_sel->core, gdisp->canvas->window, tool);
} }
@ -576,7 +592,7 @@ rect_select_motion (Tool *tool,
} }
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar),
rect_sel->context_id); rect_sel->context_id);
size = g_new (gchar, 24); /* strlen("Selection: x ") + 2*5 */ size = g_new (gchar, 25); /* strlen("Selection: x ") + 2*5 */
sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h)); sprintf (size, "Selection: %d x %d", abs(rect_sel->w), abs(rect_sel->h));
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar),
rect_sel->context_id, size); rect_sel->context_id, size);