Commit cc771294 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

plug-ins/FractalExplorer/Dialogs.c merged in a patch from Karine Delvare

2005-06-22  Sven Neumann  <sven@gimp.org>

	* plug-ins/FractalExplorer/Dialogs.c
	* plug-ins/FractalExplorer/FractalExplorer.[ch]: merged in a patch
	from Karine Delvare with further UI improvements (see bug #140202).
parent e8079d15
2005-06-22 Sven Neumann <sven@gimp.org>
* plug-ins/FractalExplorer/Dialogs.c
* plug-ins/FractalExplorer/FractalExplorer.[ch]: merged in a patch
from Karine Delvare with further UI improvements (see bug #140202).
2005-06-21 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/common/newsprint.c: remove "optimization" that interacts
......
......@@ -33,12 +33,9 @@
#include "FractalExplorer.h"
#include "Dialogs.h"
#include "logo.h"
#include "libgimp/stdplugins-intl.h"
#define RESPONSE_ABOUT 1
#define ZOOM_UNDO_SIZE 100
......@@ -100,13 +97,9 @@ static void create_load_file_chooser (GtkWidget *widget,
static void create_save_file_chooser (GtkWidget *widget,
GtkWidget *dialog);
static void explorer_logo_dialog (GtkWidget *parent);
static void cmap_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void logo_preview_size_allocate (GtkWidget *preview);
/**********************************************************************
CALLBACKS
*********************************************************************/
......@@ -118,10 +111,6 @@ dialog_response (GtkWidget *widget,
{
switch (response_id)
{
case RESPONSE_ABOUT:
explorer_logo_dialog (widget);
break;
case GTK_RESPONSE_OK:
wint.run = TRUE;
gtk_widget_destroy (widget);
......@@ -559,7 +548,6 @@ explorer_dialog (void)
NULL, 0,
gimp_standard_help_func, HELP_ID,
_("About"), RESPONSE_ABOUT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
......@@ -574,7 +562,6 @@ explorer_dialog (void)
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
RESPONSE_ABOUT,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
......@@ -1619,116 +1606,6 @@ make_color_map (void)
}
}
/**********************************************************************
FUNCTION: explorer_logo_dialog
*********************************************************************/
static void
logo_preview_size_allocate (GtkWidget *preview)
{
guchar *temp;
guchar *temp2;
guchar *datapointer;
gint x, y;
temp2 = temp = g_new (guchar, logo_height*(logo_width + 10) * 3);
datapointer = header_data + logo_width * logo_height - 1;
for (y = 0; y < logo_height; y++)
{
for (x = 0; x < logo_width; x++)
{
HEADER_PIXEL (datapointer, temp2);
temp2 += 3;
}
}
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview), 0, 0,
logo_width, logo_height, GIMP_RGB_IMAGE,
temp, logo_width * 3);
g_free (temp);
}
/**********************************************************************
FUNCTION: explorer_logo_dialog
*********************************************************************/
static void
explorer_logo_dialog (GtkWidget *parent)
{
static GtkWidget *dialog = NULL;
GtkWidget *label;
GtkWidget *vbox;
GtkWidget *abox;
GtkWidget *preview;
GtkWidget *frame;
if (dialog)
{
gtk_window_present (GTK_WINDOW (dialog));
return;
}
dialog = gimp_dialog_new (_("About"), "fractalexplorer",
parent, 0,
gimp_standard_help_func, HELP_ID,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
/* The logo frame & drawing area */
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
gtk_widget_show (abox);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type(GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (abox), frame);
gtk_widget_show (frame);
preview = gimp_preview_area_new ();
gtk_widget_set_size_request (preview, logo_width, logo_height);
gtk_container_add (GTK_CONTAINER (frame), preview);
gtk_widget_show (preview);
g_signal_connect (preview, "size_allocate",
G_CALLBACK (logo_preview_size_allocate), NULL);
label = gtk_label_new ("Fractal Chaos Explorer\n"
"Plug-In for the GIMP\n"
"Version 2.00 (Multilingual)");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
label = gtk_label_new ("\nContains code from:\n\n"
"Daniel Cotting <cotting@mygale.org>\n"
"Peter Kirchgessner <Pkirchg@aol.com>\n"
"Scott Draves <spot@cs.cmu.edu>\n"
"Andy Thomas <alt@picnic.demon.co.uk>\n"
"and the GIMP distribution.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_widget_show (dialog);
}
/**********************************************************************
FUNCTION: dialog_change_scale
*********************************************************************/
......
......@@ -39,11 +39,6 @@
many it's research." --Wilson Mizner
*********************************************************************/
/* Changes:
*
* 2000-01-05 Fixed a problem with strtok and got rid of the selfmade i18n
* Sven Neumann <sven@gimp.org>
*/
/**********************************************************************
Include necessary files
......@@ -61,11 +56,6 @@
#include <glib/gstdio.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
......@@ -82,6 +72,7 @@
#include "libgimp/stdplugins-intl.h"
/**********************************************************************
Global variables
*********************************************************************/
......@@ -697,11 +688,15 @@ delete_dialog_callback (GtkWidget *widget,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
gtk_tree_selection_get_selected (selection, &model, &iter);
gtk_tree_model_get (model, &iter, 2, &sel_obj, -1);
gtk_tree_model_get (model, &iter, 1, &sel_obj, -1);
/* Delete the current item + asssociated file */
valid = gtk_list_store_remove (GTK_LIST_STORE(model), &iter);
/* Try to select first item if last one was deleted */
if (!valid)
valid = gtk_tree_model_get_iter_first (model, &iter);
/* Shadow copy for ordering info */
fractalexplorer_list = g_list_remove (fractalexplorer_list, sel_obj);
/*
......@@ -720,7 +715,7 @@ delete_dialog_callback (GtkWidget *widget,
{
gtk_tree_selection_select_iter (selection, &iter);
gtk_tree_model_get (model, &iter, 2, &current_obj, -1);
gtk_tree_model_get (model, &iter, 1, &current_obj, -1);
}
}
else
......@@ -748,7 +743,7 @@ delete_fractal_callback (GtkWidget *widget,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter, 2, &sel_obj, -1);
gtk_tree_model_get (model, &iter, 1, &sel_obj, -1);
str = g_strdup_printf (_("Are you sure you want to delete "
"\"%s\" from the list and from disk?"),
......@@ -828,10 +823,7 @@ fill_list_store (GtkListStore *list_store)
g = tmp->data;
gtk_list_store_append (list_store, &iter);
if (g->obj_status & fractalexplorer_READONLY)
gtk_list_store_set (list_store, &iter, 0, GTK_STOCK_NO, 1, g->draw_name, 2, g, -1);
else
gtk_list_store_set (list_store, &iter, 0, GTK_STOCK_YES, 1, g->draw_name, 2, g, -1);
gtk_list_store_set (list_store, &iter, 0, g->draw_name, 1, g, -1);
}
}
......@@ -845,9 +837,9 @@ view_selection_func (GtkTreeSelection *selection,
GtkTreeIter iter;
fractalexplorerOBJ *sel_obj;
if (gtk_tree_model_get_iter(model, &iter, path))
if (gtk_tree_model_get_iter (model, &iter, path))
{
gtk_tree_model_get(model, &iter, 2, &sel_obj, -1);
gtk_tree_model_get (model, &iter, 1, &sel_obj, -1);
if (!path_currently_selected)
{
......@@ -959,13 +951,7 @@ fractalexplorer_list_load_one (const GimpDatafileData *file_data,
file_data->basename);
if (fractalexplorer)
{
/* Read only ?*/ /* FIXME: filename handling for Win32 */
if (access (filename, W_OK))
fractalexplorer->obj_status |= fractalexplorer_READONLY;
fractalexplorer_list_insert (fractalexplorer);
}
fractalexplorer_list_insert (fractalexplorer);
}
static void
......@@ -1030,23 +1016,21 @@ add_objects_list (void)
view = gtk_tree_view_new ();
col = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (col, renderer, FALSE);
gtk_tree_view_column_add_attribute (col, renderer, "stock-id", 0);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (col, renderer, TRUE);
gtk_tree_view_column_add_attribute (col, renderer, "text", 1);
gtk_tree_view_column_add_attribute (col, renderer, "text", 0);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
gtk_tree_selection_set_select_function(selection, view_selection_func, NULL, NULL);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
view);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
gtk_tree_selection_set_select_function (selection,
view_selection_func, NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_win), view);
gtk_widget_show (view);
fractalexplorer_list_load_all (fractalexplorer_path);
list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
fill_list_store (list_store);
gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (list_store));
g_object_unref (list_store); /* destroy model automatically with view */
......@@ -1129,6 +1113,7 @@ fractalexplorer_rescan_list (GtkWidget *widget,
{
GtkTreeModel *model;
GtkTreeSelection *selection;
GtkTreePath *path;
GtkTreeIter iter;
fractalexplorer_list_load_all (fractalexplorer_path);
......@@ -1142,7 +1127,11 @@ fractalexplorer_rescan_list (GtkWidget *widget,
if (gtk_tree_model_get_iter_first (model, &iter))
{
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (model, &iter);
current_obj = fractalexplorer_list->data;
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), path, NULL,
FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
}
}
}
......
......@@ -158,7 +158,6 @@ typedef struct _fractalexplorerListOptions
/* States of the object */
#define fractalexplorer_OK 0x0
#define fractalexplorer_MODIFIED 0x1
#define fractalexplorer_READONLY 0x2
#define gradient_GRADIENTEDITOR 0x2
......
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