Commit 8a43becb authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

It's hard to see, but this is introduction of multi-head support.

2003-05-22  Morten Welinder  <terra@gnome.org>

	* src/workbook-control-gui.c (workbook_menu_view): Combine the two
	New-View entries into one.
	(workbook_control_gui_init): Fix reference to freeze-panes menu
	entry.
	(cb_view_new): New function just calling the dialog.


2003-05-22  Morten Welinder  <terra@gnome.org>

	* dialog-view.c, view.glade: New files.
parent 7dfd53d1
2003-05-22 Morten Welinder <terra@gnome.org>
* src/workbook-control-gui.c (workbook_menu_view): Combine the two
New-View entries into one.
(workbook_control_gui_init): Fix reference to freeze-panes menu
entry.
(cb_view_new): New function just calling the dialog.
2003-05-21 Jody Goldberg <jody@gnome.org>
* src/item-edit.c : General de-cruftification.
......
......@@ -36,7 +36,7 @@ Morten:
* Improve remote-DISPLAY start-up time by getting rid of calls to
deprecated gtk_style_get_font function.
* Start getting rid of use of deprecated features.
* Start gnumeric multi-head safe.
* Multihead support.
--------------------------------------------------------------------------
......
2003-05-22 Morten Welinder <terra@gnome.org>
* src/workbook-control-gui.c (workbook_menu_view): Combine the two
New-View entries into one.
(workbook_control_gui_init): Fix reference to freeze-panes menu
entry.
(cb_view_new): New function just calling the dialog.
2003-05-21 Jody Goldberg <jody@gnome.org>
* src/item-edit.c : General de-cruftification.
......
2003-05-22 Morten Welinder <terra@gnome.org>
* src/workbook-control-gui.c (workbook_menu_view): Combine the two
New-View entries into one.
(workbook_control_gui_init): Fix reference to freeze-panes menu
entry.
(cb_view_new): New function just calling the dialog.
2003-05-21 Jody Goldberg <jody@gnome.org>
* src/item-edit.c : General de-cruftification.
......
......@@ -178,6 +178,7 @@ src/dialogs/dialog-stf-preview.h
src/dialogs/dialog-stf.c
src/dialogs/dialog-stf.glade
src/dialogs/dialog-tabulate.c
src/dialogs/dialog-view.c
src/dialogs/dialog-workbook-attr.c
src/dialogs/dialog-zoom.c
src/dialogs/dialog-zoom.glade
......@@ -222,6 +223,7 @@ src/dialogs/solver.glade
src/dialogs/summary.glade
src/dialogs/tabulate.glade
src/dialogs/variance-tests.glade
src/dialogs/view.glade
src/dialogs/workbook-attr.glade
src/expr-name.c
src/expr.c
......
......@@ -308,13 +308,8 @@
<submenu name="View" _label="_View">
<menuitem name="ViewNewShared" verb=""
_label="New _Shared"
_label="_New View..."
_tip="Create a new shared view of the workbook"/>
<menuitem name="ViewNewUnshared" verb=""
_label="New _Unshared"
_tip="Create a new unshared view of the workbook"/>
<separator/>
<menuitem name="ViewZoom" verb=""
_label="_Zoom..."
......
2003-05-22 Morten Welinder <terra@gnome.org>
* dialog-view.c, view.glade: New files.
2003-05-21 Morten Welinder <terra@gnome.org>
* dialog-printer-setup.c (unit_editor_configure): Get pango
......
......@@ -71,6 +71,7 @@ base_files = \
dialog-stf-export-format-page.c \
dialog-tabulate.c \
dialog-summary.c \
dialog-view.c \
dialog-workbook-attr.c \
dialog-zoom.c \
dialogs.h \
......@@ -140,6 +141,7 @@ glade_DATA = \
summary.glade \
tabulate.glade \
variance-tests.glade \
view.glade \
workbook-attr.glade
EXTRA_DIST = $(glade_DATA)
/**
* dialog-view.c: New view dialog.
*
* Author:
* Morten Welinder <terra@gnome.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gnumeric-config.h>
#include <gnumeric-i18n.h>
#include <gnumeric.h>
#include "dialogs.h"
#include <glade/glade.h>
#include <gui-util.h>
#include <workbook-control-gui.h>
#define VIEW_DIALOG_KEY "view-dialog"
static const char *shared_group[] = {
"view_shared",
"view_unshared",
0
};
typedef struct {
WorkbookControlGUI *wbcg;
GtkWidget *dialog;
GladeXML *gui;
GtkRadioButton *location_elsewhere;
GtkEntry *location_display_name;
} ViewState;
static void
cb_view_cancel_clicked (G_GNUC_UNUSED GtkWidget *button,
ViewState *state)
{
gtk_widget_destroy (state->dialog);
}
static void
cb_view_ok_clicked (G_GNUC_UNUSED GtkWidget *button,
ViewState *state)
{
WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
gboolean shared;
GdkScreen *screen = NULL;
GSList *buttons = gtk_radio_button_get_group (state->location_elsewhere);
WorkbookControl *new_wbc;
WorkbookControlGUI *new_wbcg;
shared = gnumeric_glade_group_value (state->gui, shared_group) == 0;
while (buttons)
if (gtk_toggle_button_get_active (buttons->data))
break;
else
buttons = buttons->next;
if (!buttons) {
g_assert_not_reached ();
return;
} else if (buttons->data == state->location_elsewhere) {
const char *name = gtk_entry_get_text (state->location_display_name);
GdkDisplay *display;
if (!name)
return; /* Just ignore */
display = gdk_display_open (name);
if (!display) {
char *error_str =
g_strdup_printf (_("Display \"%s\" could not be opened."),
name);
gtk_widget_destroy (state->dialog);
gnumeric_notice (state->wbcg, GTK_MESSAGE_ERROR, error_str);
g_free (error_str);
return;
}
screen = gdk_display_get_default_screen (display);
} else {
screen = g_object_get_data (buttons->data, "screen");
/* screen will be NULL for current screen. */
}
gtk_widget_destroy (state->dialog);
new_wbc = wb_control_wrapper_new
(wbc,
shared ? wb_control_view (wbc) : NULL,
wb_control_workbook (wbc));
new_wbcg = WORKBOOK_CONTROL_GUI (new_wbc);
if (screen)
gtk_window_set_screen (wbcg_toplevel (new_wbcg), screen);
}
static void
cb_view_destroy (ViewState *state)
{
if (state->gui != NULL) {
g_object_unref (G_OBJECT (state->gui));
state->gui = NULL;
}
state->dialog = NULL;
g_free (state);
}
static void
cb_focus_to_location_display_name (GtkToggleButton *togglebutton, ViewState *state)
{
if (gtk_toggle_button_get_active (togglebutton))
gtk_widget_grab_focus (GTK_WIDGET (state->location_display_name));
}
static gboolean
cb_display_name_selected (G_GNUC_UNUSED GtkWidget *widget,
G_GNUC_UNUSED GdkEventFocus *event, ViewState *state)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->location_elsewhere), TRUE);
return FALSE;
}
void
dialog_new_view (WorkbookControlGUI *wbcg)
{
ViewState *state;
GladeXML *gui;
if (gnumeric_dialog_raise_if_exists (wbcg, VIEW_DIALOG_KEY))
return;
gui = gnm_glade_xml_new (COMMAND_CONTEXT (wbcg),
"view.glade", NULL, NULL);
if (gui == NULL)
return;
state = g_new (ViewState, 1);
state->wbcg = wbcg;
state->gui = gui;
state->dialog = glade_xml_get_widget (gui, "View");
state->location_elsewhere = GTK_RADIO_BUTTON (glade_xml_get_widget (gui, "location_elsewhere"));
state->location_display_name = GTK_ENTRY (glade_xml_get_widget (gui, "location_display_name"));
g_return_if_fail (state->dialog != NULL);
{
GdkScreen *this_screen = gtk_window_get_screen (wbcg_toplevel (wbcg));
GdkDisplay *this_display = gdk_screen_get_display (this_screen);
int n_screens = gdk_display_get_n_screens (this_display);
GtkBox *box = GTK_BOX (glade_xml_get_widget (gui, "location_screens_vbox"));
int i;
for (i = 0; i < n_screens; i++) {
/* Get this for every screen -- it might change. */
GSList *group =
gtk_radio_button_get_group (state->location_elsewhere);
GdkScreen *screen = gdk_display_get_screen (this_display, i);
char *label =
screen == this_screen
? (n_screens == 1
? g_strdup (_("This screen"))
: g_strdup_printf (_("Screen %d [This screen]"), i))
: g_strdup_printf (_("Screen %d"), i);
GtkWidget *button =
gtk_radio_button_new_with_label (group, label);
g_free (label);
if (screen == this_screen)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
else
g_object_set_data (G_OBJECT (button),
"screen",
screen);
gtk_box_pack_start (box, button, TRUE, TRUE, 0);
}
}
g_signal_connect (G_OBJECT (glade_xml_get_widget (gui, "ok_button")),
"clicked",
G_CALLBACK (cb_view_ok_clicked), state);
g_signal_connect (G_OBJECT (glade_xml_get_widget (gui, "cancel_button")),
"clicked",
G_CALLBACK (cb_view_cancel_clicked), state);
g_signal_connect (G_OBJECT (state->location_elsewhere),
"clicked", G_CALLBACK (cb_focus_to_location_display_name),
(gpointer) state);
g_signal_connect (G_OBJECT (state->location_display_name),
"focus_in_event",
G_CALLBACK (cb_display_name_selected), state);
gnumeric_editable_enters (GTK_WINDOW (state->dialog),
GTK_WIDGET (state->location_display_name));
gnumeric_init_help_button (
glade_xml_get_widget (gui, "help_button"),
"view.html");
gnumeric_keyed_dialog (wbcg, GTK_WINDOW (state->dialog),
VIEW_DIALOG_KEY);
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify) cb_view_destroy);
gtk_widget_show_all (state->dialog);
}
......@@ -107,5 +107,6 @@ char *dialog_get_password (GtkWindow *parent, const char *filename);
void dialog_summary_update (WorkbookControlGUI *wbcg, gboolean open_dialogs);
void dialog_preferences (WorkbookControlGUI *wbcg, gint page);
void dialog_new_view (WorkbookControlGUI *wbcg);
#endif /* GNUMERIC_DIALOGS_H */
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="View">
<property name="title" translatable="yes">Create New View</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="help_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkVBox" id="location_screens_vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="location_elsewhere">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">New view will be opened on specified screen</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Elsewhere</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="location_display_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Location</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="view_shared">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Views will share cursor position</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Shared</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="view_unshared">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Views will have separate cursor locations</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Unshared</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">view_shared</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Sharing</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
......@@ -248,12 +248,12 @@ history_menu_remove_items (WorkbookControlGUI *wbcg, GSList *name_list)
CORBA_exception_init (&ev);
bonobo_ui_component_freeze (wbcg->uic, &ev);
for (l = name_list; l; l = l->next) {
#warning "FIXME: this doesn't even look at ->data"
char *path;
path = g_strdup_printf ("/menu/File/FileHistory/FileHistory%d",
accel_number++);
bonobo_ui_component_rm (wbcg->uic,
path, &ev);
bonobo_ui_component_rm (wbcg->uic, path, &ev);
g_free (path);
}
bonobo_ui_component_thaw (wbcg->uic, &ev);
......
......@@ -2337,19 +2337,9 @@ cb_view_freeze_panes (GtkWidget *widget, WorkbookControlGUI *wbcg)
}
static void
cb_view_new_shared (GtkWidget *widget, WorkbookControlGUI *wbcg)
cb_view_new (G_GNUC_UNUSED GtkWidget *widget, WorkbookControlGUI *wbcg)
{
WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
wb_control_wrapper_new (wbc, wb_control_view (wbc),
wb_control_workbook (wbc));
}
static void
cb_view_new_unshared (GtkWidget *widget, WorkbookControlGUI *wbcg)
{
WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
wb_control_wrapper_new (wbc, NULL,
wb_control_workbook (wbc));
dialog_new_view (wbcg);
}
/****************************************************************************/
......@@ -3400,15 +3390,9 @@ static GnomeUIInfo workbook_menu_edit [] = {
/* View menu */
static GnomeUIInfo workbook_menu_view [] = {
GNOMEUIINFO_ITEM_NONE (N_("New _Shared"),
N_("Create a new shared view of the workbook"),
cb_view_new_shared),
GNOMEUIINFO_ITEM_NONE (N_("New _Unshared"),
N_("Create a new unshared view of the workbook"),
cb_view_new_unshared),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_NONE (N_("_New View..."),
N_("Create a new view of the workbook"),
cb_view_new),
GNOMEUIINFO_ITEM_NONE (N_("_Zoom..."),
N_("Zoom the spreadsheet in or out"),
cb_view_zoom),
......@@ -3970,8 +3954,7 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("EditGoto", cb_edit_goto),
BONOBO_UI_UNSAFE_VERB ("EditRecalc", cb_edit_recalc),
BONOBO_UI_UNSAFE_VERB ("ViewNewShared", cb_view_new_shared),
BONOBO_UI_UNSAFE_VERB ("ViewNewUnshared", cb_view_new_unshared),
BONOBO_UI_UNSAFE_VERB ("ViewNew", cb_view_new),
BONOBO_UI_UNSAFE_VERB ("ViewZoom", cb_view_zoom),
BONOBO_UI_UNSAFE_VERB ("ViewFreezeThawPanes", cb_view_freeze_panes),
......@@ -5096,7 +5079,7 @@ workbook_control_gui_init (WorkbookControlGUI *wbcg,
wbcg->menu_item_consolidate =
workbook_menu_data [4].widget;
wbcg->menu_item_freeze_panes =
workbook_menu_view [4].widget;
workbook_menu_view [2].widget;
wbcg->menu_item_sheet_display_formulas =
workbook_menu_format_sheet [2].widget;
......
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