Commit 9a9ee85e authored by Sven Neumann's avatar Sven Neumann
Browse files

allow the user to choose the default for "Dot for Dot"


--Sven
parent 13edd851
Sun Jan 9 19:59:38 CET 2000 Sven Neumann <sven@gimp.org>
* app/gdisplay.c
* app/gimprc.c
* app/gimprc.h
* app/interface.c
* app/preferences_dialog.c: allow the user to choose the default for
"Dot for Dot"
* app/paint_options.h
* app/tool_options.c: declare non_gui_pressure_options as extern and
define it in the C file
Sun Jan 9 18:15:44 CET 2000 Sven Neumann <sven@gimp.org>
 
* plug-ins/common/colortoalpha.c
......
......@@ -100,7 +100,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale;
gdisp->dot_for_dot = TRUE;
gdisp->dot_for_dot = default_dot_for_dot;
gdisp->gimage = gimage;
gdisp->window_info_dialog = NULL;
gdisp->window_nav_dialog = NULL;
......
......@@ -28,6 +28,18 @@
#include "libgimp/gimpintl.h"
/* declared extern in paint_options.h */
PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
/* a list of all PaintOptions */
static GSList *paint_options_list = NULL;
......
......@@ -93,6 +93,7 @@ static double old_default_xresolution;
static double old_default_yresolution;
static GUnit old_default_resolution_units;
static int old_default_type;
static int old_default_dot_for_dot;
static int old_stingy_memory_use;
static int old_tile_cache_size;
static int old_install_cmap;
......@@ -561,6 +562,11 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-resolution-units");
if (default_type != old_default_type)
update = g_list_append (update, "default-image-type");
if (default_dot_for_dot != old_default_dot_for_dot)
{
update = g_list_append (update, "default-dot-for-dot");
remove = g_list_append (remove, "dont-default-dot-for-dot");
}
if (preview_size != old_preview_size)
update = g_list_append (update, "preview-size");
if (nav_preview_size != old_nav_preview_size)
......@@ -704,6 +710,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
default_yresolution = old_default_yresolution;
default_resolution_units = old_default_resolution_units;
default_type = old_default_type;
default_dot_for_dot = old_default_dot_for_dot;
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
......@@ -803,6 +810,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
{
default_type = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else if (data == &default_dot_for_dot)
default_dot_for_dot = GTK_TOGGLE_BUTTON (widget)->active;
else if ((data == &transparency_type) ||
(data == &transparency_size))
{
......@@ -1302,6 +1311,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_default_yresolution = default_yresolution;
old_default_resolution_units = default_resolution_units;
old_default_type = default_type;
old_default_dot_for_dot = default_dot_for_dot;
old_stingy_memory_use = edit_stingy_memory_use;
old_tile_cache_size = edit_tile_cache_size;
old_install_cmap = edit_install_cmap;
......@@ -1855,7 +1865,7 @@ file_pref_cmd_callback (GtkWidget *widget,
vbox2 = file_prefs_frame_new (_("Pointer Movement Feedback"), GTK_BOX (vbox));
button =
gtk_check_button_new_with_label(_("Perfect-but-slow Pointer Tracking"));
gtk_check_button_new_with_label (_("Perfect-but-slow Pointer Tracking"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
perfectmouse);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -1864,7 +1874,7 @@ file_pref_cmd_callback (GtkWidget *widget,
&perfectmouse);
gtk_widget_show (button);
button = gtk_check_button_new_with_label(_("Disable Cursor Updating"));
button = gtk_check_button_new_with_label (_("Disable Cursor Updating"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
no_cursor_updating);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -1873,6 +1883,21 @@ file_pref_cmd_callback (GtkWidget *widget,
&no_cursor_updating);
gtk_widget_show (button);
/* Dot for dot */
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
button = gtk_check_button_new_with_label (_("Use \"Dot for Dot\" by default"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
default_dot_for_dot);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (file_prefs_toggle_callback),
&default_dot_for_dot);
gtk_widget_show (button);
/* Interface / Tool Options */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Tool Options Settings"),
......
......@@ -100,7 +100,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale;
gdisp->dot_for_dot = TRUE;
gdisp->dot_for_dot = default_dot_for_dot;
gdisp->gimage = gimage;
gdisp->window_info_dialog = NULL;
gdisp->window_nav_dialog = NULL;
......
......@@ -663,11 +663,11 @@ create_display_shell (GDisplay* gdisp,
s_width = gdk_screen_width ();
s_height = gdk_screen_height ();
scalesrc = gdisp->scale & 0x00ff;
scaledest = gdisp->scale >> 8;
scalesrc = SCALESRC (gdisp);
scaledest = SCALEDEST (gdisp);
n_width = (width * scaledest) / scalesrc;
n_height = (height * scaledest) / scalesrc;
n_width = SCALEX (gdisp, width);
n_height = SCALEX (gdisp, height);
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
......@@ -678,8 +678,10 @@ create_display_shell (GDisplay* gdisp,
if (scalesrc < 0xff)
scalesrc++;
n_width = (width * scaledest) / scalesrc;
n_height = (height * scaledest) / scalesrc;
n_width = width *
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
n_height = height *
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
}
gdisp->scale = (scaledest << 8) + scalesrc;
......
......@@ -663,11 +663,11 @@ create_display_shell (GDisplay* gdisp,
s_width = gdk_screen_width ();
s_height = gdk_screen_height ();
scalesrc = gdisp->scale & 0x00ff;
scaledest = gdisp->scale >> 8;
scalesrc = SCALESRC (gdisp);
scaledest = SCALEDEST (gdisp);
n_width = (width * scaledest) / scalesrc;
n_height = (height * scaledest) / scalesrc;
n_width = SCALEX (gdisp, width);
n_height = SCALEX (gdisp, height);
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
......@@ -678,8 +678,10 @@ create_display_shell (GDisplay* gdisp,
if (scalesrc < 0xff)
scalesrc++;
n_width = (width * scaledest) / scalesrc;
n_height = (height * scaledest) / scalesrc;
n_width = width *
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
n_height = height *
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
}
gdisp->scale = (scaledest << 8) + scalesrc;
......
......@@ -100,7 +100,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->offset_x = gdisp->offset_y = 0;
gdisp->scale = scale;
gdisp->dot_for_dot = TRUE;
gdisp->dot_for_dot = default_dot_for_dot;
gdisp->gimage = gimage;
gdisp->window_info_dialog = NULL;
gdisp->window_nav_dialog = NULL;
......
......@@ -147,6 +147,7 @@ int default_type = RGB;
double default_xresolution = 72.0;
double default_yresolution = 72.0;
GUnit default_resolution_units = UNIT_INCH;
int default_dot_for_dot = TRUE;
int show_tips = TRUE;
int last_tip = -1;
int show_tool_tips = TRUE;
......@@ -292,11 +293,12 @@ static ParseFunc funcs[] =
{ "last-tip-shown", TT_INT, &last_tip, NULL },
{ "show-tool-tips", TT_BOOLEAN, &show_tool_tips, NULL },
{ "dont-show-tool-tips", TT_BOOLEAN, NULL, &show_tool_tips },
{ "default-image-size", TT_POSITION, &default_width, &default_height },
{ "default-image-size", TT_POSITION, &default_width, &default_height },
{ "default-image-type", TT_IMAGETYPE, &default_type, NULL },
{ "default-xresolution", TT_DOUBLE, &default_xresolution, NULL },
{ "default-yresolution", TT_DOUBLE, &default_yresolution, NULL },
{ "default-resolution-units", TT_XUNIT, &default_resolution_units, NULL },
{ "default-resolution-units", TT_XUNIT, &default_resolution_units, NULL },
{ "default-dot-for-dot", TT_BOOLEAN, &default_dot_for_dot, NULL },
{ "plug-in", TT_XPLUGIN, NULL, NULL },
{ "plug-in-def", TT_XPLUGINDEF, NULL, NULL },
{ "menu-path", TT_XMENUPATH, NULL, NULL },
......
......@@ -65,6 +65,7 @@ extern int default_type;
extern GUnit default_resolution_units;
extern double default_xresolution;
extern double default_yresolution;
extern int default_dot_for_dot;
extern int save_session_info;
extern int save_device_status;
extern int always_restore_session;
......
......@@ -93,6 +93,7 @@ static double old_default_xresolution;
static double old_default_yresolution;
static GUnit old_default_resolution_units;
static int old_default_type;
static int old_default_dot_for_dot;
static int old_stingy_memory_use;
static int old_tile_cache_size;
static int old_install_cmap;
......@@ -561,6 +562,11 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-resolution-units");
if (default_type != old_default_type)
update = g_list_append (update, "default-image-type");
if (default_dot_for_dot != old_default_dot_for_dot)
{
update = g_list_append (update, "default-dot-for-dot");
remove = g_list_append (remove, "dont-default-dot-for-dot");
}
if (preview_size != old_preview_size)
update = g_list_append (update, "preview-size");
if (nav_preview_size != old_nav_preview_size)
......@@ -704,6 +710,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
default_yresolution = old_default_yresolution;
default_resolution_units = old_default_resolution_units;
default_type = old_default_type;
default_dot_for_dot = old_default_dot_for_dot;
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
......@@ -803,6 +810,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
{
default_type = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else if (data == &default_dot_for_dot)
default_dot_for_dot = GTK_TOGGLE_BUTTON (widget)->active;
else if ((data == &transparency_type) ||
(data == &transparency_size))
{
......@@ -1302,6 +1311,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_default_yresolution = default_yresolution;
old_default_resolution_units = default_resolution_units;
old_default_type = default_type;
old_default_dot_for_dot = default_dot_for_dot;
old_stingy_memory_use = edit_stingy_memory_use;
old_tile_cache_size = edit_tile_cache_size;
old_install_cmap = edit_install_cmap;
......@@ -1855,7 +1865,7 @@ file_pref_cmd_callback (GtkWidget *widget,
vbox2 = file_prefs_frame_new (_("Pointer Movement Feedback"), GTK_BOX (vbox));
button =
gtk_check_button_new_with_label(_("Perfect-but-slow Pointer Tracking"));
gtk_check_button_new_with_label (_("Perfect-but-slow Pointer Tracking"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
perfectmouse);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -1864,7 +1874,7 @@ file_pref_cmd_callback (GtkWidget *widget,
&perfectmouse);
gtk_widget_show (button);
button = gtk_check_button_new_with_label(_("Disable Cursor Updating"));
button = gtk_check_button_new_with_label (_("Disable Cursor Updating"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
no_cursor_updating);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -1873,6 +1883,21 @@ file_pref_cmd_callback (GtkWidget *widget,
&no_cursor_updating);
gtk_widget_show (button);
/* Dot for dot */
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
button = gtk_check_button_new_with_label (_("Use \"Dot for Dot\" by default"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
default_dot_for_dot);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (file_prefs_toggle_callback),
&default_dot_for_dot);
gtk_widget_show (button);
/* Interface / Tool Options */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Tool Options Settings"),
......
......@@ -663,11 +663,11 @@ create_display_shell (GDisplay* gdisp,
s_width = gdk_screen_width ();
s_height = gdk_screen_height ();
scalesrc = gdisp->scale & 0x00ff;
scaledest = gdisp->scale >> 8;
scalesrc = SCALESRC (gdisp);
scaledest = SCALEDEST (gdisp);
n_width = (width * scaledest) / scalesrc;
n_height = (height * scaledest) / scalesrc;
n_width = SCALEX (gdisp, width);
n_height = SCALEX (gdisp, height);
/* Limit to the size of the screen... */
while (n_width > s_width || n_height > s_height)
......@@ -678,8 +678,10 @@ create_display_shell (GDisplay* gdisp,
if (scalesrc < 0xff)
scalesrc++;
n_width = (width * scaledest) / scalesrc;
n_height = (height * scaledest) / scalesrc;
n_width = width *
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
n_height = height *
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
}
gdisp->scale = (scaledest << 8) + scalesrc;
......
......@@ -76,15 +76,8 @@ struct _PaintOptions
/* the default pressure_options for non_gui use */
static PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
extern PaintPressureOptions non_gui_pressure_options;
/* paint tool options functions */
......
......@@ -93,6 +93,7 @@ static double old_default_xresolution;
static double old_default_yresolution;
static GUnit old_default_resolution_units;
static int old_default_type;
static int old_default_dot_for_dot;
static int old_stingy_memory_use;
static int old_tile_cache_size;
static int old_install_cmap;
......@@ -561,6 +562,11 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-resolution-units");
if (default_type != old_default_type)
update = g_list_append (update, "default-image-type");
if (default_dot_for_dot != old_default_dot_for_dot)
{
update = g_list_append (update, "default-dot-for-dot");
remove = g_list_append (remove, "dont-default-dot-for-dot");
}
if (preview_size != old_preview_size)
update = g_list_append (update, "preview-size");
if (nav_preview_size != old_nav_preview_size)
......@@ -704,6 +710,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
default_yresolution = old_default_yresolution;
default_resolution_units = old_default_resolution_units;
default_type = old_default_type;
default_dot_for_dot = old_default_dot_for_dot;
monitor_xres = old_monitor_xres;
monitor_yres = old_monitor_yres;
using_xserver_resolution = old_using_xserver_resolution;
......@@ -803,6 +810,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
{
default_type = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else if (data == &default_dot_for_dot)
default_dot_for_dot = GTK_TOGGLE_BUTTON (widget)->active;
else if ((data == &transparency_type) ||
(data == &transparency_size))
{
......@@ -1302,6 +1311,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_default_yresolution = default_yresolution;
old_default_resolution_units = default_resolution_units;
old_default_type = default_type;
old_default_dot_for_dot = default_dot_for_dot;
old_stingy_memory_use = edit_stingy_memory_use;
old_tile_cache_size = edit_tile_cache_size;
old_install_cmap = edit_install_cmap;
......@@ -1855,7 +1865,7 @@ file_pref_cmd_callback (GtkWidget *widget,
vbox2 = file_prefs_frame_new (_("Pointer Movement Feedback"), GTK_BOX (vbox));
button =
gtk_check_button_new_with_label(_("Perfect-but-slow Pointer Tracking"));
gtk_check_button_new_with_label (_("Perfect-but-slow Pointer Tracking"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
perfectmouse);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -1864,7 +1874,7 @@ file_pref_cmd_callback (GtkWidget *widget,
&perfectmouse);
gtk_widget_show (button);
button = gtk_check_button_new_with_label(_("Disable Cursor Updating"));
button = gtk_check_button_new_with_label (_("Disable Cursor Updating"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
no_cursor_updating);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -1873,6 +1883,21 @@ file_pref_cmd_callback (GtkWidget *widget,
&no_cursor_updating);
gtk_widget_show (button);
/* Dot for dot */
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
button = gtk_check_button_new_with_label (_("Use \"Dot for Dot\" by default"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
default_dot_for_dot);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (file_prefs_toggle_callback),
&default_dot_for_dot);
gtk_widget_show (button);
/* Interface / Tool Options */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Tool Options Settings"),
......
......@@ -28,6 +28,18 @@
#include "libgimp/gimpintl.h"
/* declared extern in paint_options.h */
PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
/* a list of all PaintOptions */
static GSList *paint_options_list = NULL;
......
......@@ -76,15 +76,8 @@ struct _PaintOptions
/* the default pressure_options for non_gui use */
static PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
extern PaintPressureOptions non_gui_pressure_options;
/* paint tool options functions */
......
......@@ -76,15 +76,8 @@ struct _PaintOptions
/* the default pressure_options for non_gui use */
static PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
extern PaintPressureOptions non_gui_pressure_options;
/* paint tool options functions */
......
......@@ -28,6 +28,18 @@
#include "libgimp/gimpintl.h"
/* declared extern in paint_options.h */
PaintPressureOptions non_gui_pressure_options =
{
NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL,
FALSE, FALSE, NULL
};
/* a list of all PaintOptions */
static GSList *paint_options_list = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment