Commit 61fa98f6 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow
Browse files

port to gnome2 and redesign as guru using treeview initial port to gnome2

2002-02-03  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* cell-sort.glade : port to gnome2 and redesign as guru using
	  treeview
	* dialog-cell-sort.c : initial port to gnome2 and
	  guru-ification, sorting is currently disabled util completion
	  of this port.
parent 871694d2
2002-02-03 Andreas J. Guelzow <aguelzow@taliesin.ca>
* cell-sort.glade : port to gnome2 and redesign as guru using
treeview
* dialog-cell-sort.c : initial port to gnome2 and
guru-ification, sorting is currently disabled util completion
of this port.
2002-02-02 Jody Goldberg <jody@gnome.org>
* autoformat.glade : Consistently Use 'label:' rather than 'label :'
......
......@@ -6,7 +6,7 @@
<property name="visible">no</property>
<property name="title" translatable="yes">Sort...</property>
<property name="type">GTK_WINDOW_DIALOG</property>
<property name="modal">yes</property>
<property name="modal">no</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">no</property>
<property name="window-position">GTK_WIN_POS_CENTER</property>
......@@ -24,7 +24,7 @@
<property name="visible">yes</property>
<child>
<widget class="GtkButton" id="button4">
<widget class="GtkButton" id="ok_button">
<property name="can_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
......@@ -35,29 +35,22 @@
</child>
<child>
<widget class="GtkButton" id="cell_sort_add">
<widget class="GtkButton" id="cancel_button">
<property name="can_default">yes</property>
<property name="can_focus">yes</property>
<property name="label" translatable="yes">Add</property>
<property name="visible">yes</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="cell_sort_remove">
<property name="can_default">yes</property>
<property name="can_focus">yes</property>
<property name="label" translatable="yes">Remove</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button8">
<widget class="GtkButton" id="help_button">
<property name="can_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="label" translatable="yes">gtk-help</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
</widget>
......@@ -73,18 +66,151 @@
<child>
<widget class="GtkTable" id="cell_sort_table">
<property name="border_width">5</property>
<property name="homogeneous">no</property>
<property name="row_spacing">4</property>
<property name="column_spacing">4</property>
<property name="n-rows">2</property>
<property name="n-columns">1</property>
<property name="n-rows">3</property>
<property name="n-columns">2</property>
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="var1-label">
<property name="label" translatable="yes">Sort Range:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">no</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">5</property>
<property name="visible">yes</property>
<property name="use_underline">yes</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="homogeneous">yes</property>
<property name="spacing">4</property>
<property name="visible">yes</property>
<widget class="GtkFrame" id="frame3">
<property name="label" translatable="yes">Sort Specification</property>
<property name="label_xalign">0</property>
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
<property name="visible">yes</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="border_width">4</property>
<property name="homogeneous">no</property>
<property name="spacing">4</property>
<property name="visible">yes</property>
<child>
<widget class="GtkScrolledWindow" id="scrolled_cell_sort_list">
<property name="width_request">400</property>
<property name="height_request">200</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="visible">yes</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">1</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkButton" id="up_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-up</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkButton" id="down_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-down</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
</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">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
<property name="y_options">expand|fill</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame2">
......@@ -106,9 +232,14 @@
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
<property name="y_options">expand|fill</property>
</packing>
</child>
......@@ -162,190 +293,17 @@
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
<property name="y_options">expand|fill</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
<property name="y_options">expand|fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
</packing>
</child>
</widget>
<widget class="GtkDialog" id="CellSortAdvanced">
<property name="visible">no</property>
<property name="title" translatable="yes">Advanced Sort Options</property>
<property name="type">GTK_WINDOW_DIALOG</property>
<property name="modal">yes</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">no</property>
<property name="window-position">GTK_WIN_POS_CENTER</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
<property name="homogeneous">no</property>
<property name="spacing">8</property>
<property name="visible">yes</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area3">
<property name="layout_style">GTK_BUTTONBOX_START</property>
<property name="spacing">8</property>
<property name="visible">yes</property>
<child>
<widget class="GtkButton" id="button9">
<property name="can_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button10">
<property name="can_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">yes</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="homogeneous">no</property>
<property name="row_spacing">4</property>
<property name="column_spacing">4</property>
<property name="n-rows">2</property>
<property name="n-columns">1</property>
<property name="visible">yes</property>
<child>
<widget class="GtkFrame" id="frame5">
<property name="label" translatable="yes">Sort by</property>
<property name="label_xalign">0</property>
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
<property name="visible">yes</property>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="border_width">4</property>
<property name="homogeneous">yes</property>
<property name="spacing">4</property>
<property name="visible">yes</property>
<child>
<widget class="GtkRadioButton" id="cell_sort_adv_value">
<property name="can_focus">yes</property>
<property name="label" translatable="yes">_Value</property>
<property name="active">yes</property>
<property name="draw_indicator">yes</property>
<property name="visible">yes</property>
<property name="use_underline">yes</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="cell_sort_adv_text">
<property name="can_focus">yes</property>
<property name="label" translatable="yes">_Text</property>
<property name="active">no</property>
<property name="draw_indicator">yes</property>
<property name="visible">yes</property>
<property name="group">cell_sort_adv_value</property>
<property name="use_underline">yes</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
<property name="y_options">expand|fill</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame6">
<property name="label" translatable="yes">Entries are</property>
<property name="label_xalign">0</property>
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
<property name="visible">yes</property>
<child>
<widget class="GtkCheckButton" id="cell_sort_adv_case">
<property name="border_width">4</property>
<property name="can_focus">yes</property>
<property name="has_focus">yes</property>
<property name="label" translatable="yes">_Case sensitive</property>
<property name="active">no</property>
<property name="draw_indicator">yes</property>
<property name="visible">yes</property>
<property name="use_underline">yes</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">fill</property>
<property name="y_options">expand|fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -4,6 +4,7 @@
* Authors:
* JP Rosevear <jpr@arcavia.com>
* Michael Meeks <michael@imaginator.com>
* Andreas J. Guelzow <aguelzow@taliesin.ca>
*/
#include <gnumeric-config.h>
......@@ -22,44 +23,39 @@
#include <workbook.h>
#include <sort.h>
#include <sheet.h>
#include <workbook-edit.h>
#include <widgets/gnumeric-expr-entry.h>
#include <libgnome/gnome-i18n.h>
#include <glade/glade.h>
#include <gal/util/e-util.h>
#include <ctype.h>
#include <stdio.h>
#define GLADE_FILE "cell-sort.glade"
#define MAX_CLAUSE 6
#define BUTTON_OK 0
#define BUTTON_ADD BUTTON_OK + 1
#define BUTTON_REMOVE BUTTON_ADD + 1
#define BUTTON_CANCEL BUTTON_REMOVE + 1
#define CELL_SORT_KEY "cell-sort-dialog"
typedef struct {
GtkWidget *parent;
GtkWidget *main_frame;
GtkWidget *rangetext;
int text_cursor_pos;
int asc;
GtkWidget *asc_desc;
GSList *group;
gboolean cs;
gboolean val;
GtkWidget *adv_button;
Sheet *sheet;
WorkbookControlGUI *wbcg;
} OrderBox;
Workbook *wb;
GladeXML *gui;
GtkWidget *dialog;
GtkWidget *warning_dialog;
GtkWidget *cancel_button;
GtkWidget *ok_button;
GtkWidget *help_button;
GnumericExprEntry *range_entry;
GtkListStore *model;
GtkTreeView *treeview;
GtkTreeSelection *selection;
typedef struct {
Range *sel;
Sheet *sheet;
WorkbookControlGUI *wbcg;
int num_clause;
int max_col_clause;
int max_row_clause;
OrderBox *clauses[MAX_CLAUSE];
GtkWidget *dialog;
GtkWidget *clause_box;
gboolean header;
gboolean top;
......@@ -67,8 +63,48 @@ typedef struct {
GList *colnames_header;
GList *rownames_plain;
GList *rownames_header;
} SortFlow;
} SortFlowState;
enum {
ITEM_IN_USE,
ITEM_NAME,
ITEM_DESCENDING,
ITEM_CASE_SENSITIVE,
ITEM_SORT_BY_VALUE,
ITEM_MOVE_FORMAT,
ITEM_NUMBER,
NUM_COLMNS
};
static void
cb_dialog_help (GtkWidget *button, char const *link)
{
gnumeric_help_display (link);
}
/**
* dialog_set_focus:
* @window:
* @focus_widget:
* @state:
*
**/
static void
dialog_set_focus (GtkWidget *window, GtkWidget *focus_widget,
SortFlowState *state)
{
if (IS_GNUMERIC_EXPR_ENTRY (focus_widget)) {
wbcg_set_entry (state->wbcg,
GNUMERIC_EXPR_ENTRY (focus_widget));
gnumeric_expr_entry_set_absolute (GNUMERIC_EXPR_ENTRY (focus_widget));
} else
wbcg_set_entry (state->wbcg, NULL);
}
#warning Cell-sort temporarily disabled we will fix this soon (AJG)
#if 0
static gchar *
col_row_name (Sheet *sheet, int col, int row, gboolean header, gboolean is_cols)
......@@ -483,22 +519,171 @@ dialog_cell_sort_cols_toggled (GtkWidget *widget, SortFlow *sf)
}
}
#endif
/**
* dialog_destroy:
* @window:
* @focus_widget:
* @state:
*
* Destroy the dialog and associated data structures.
*
**/
static gboolean
dialog_destroy (GtkObject *w, SortFlowState *state)
{
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (state != NULL, FALSE);
wbcg_edit_detach_guru (state->wbcg);
if (state->gui != NULL) {
g_object_unref (G_OBJECT (state->gui));
state->gui = NULL;
}
wbcg_edit_finish (state->wbcg, FALSE);
state->dialog = NULL;
g_free (state);
return FALSE;
}
/**
* cb_dialog_cancel_clicked:
* @button:
* @state:
*
* Close (destroy) the dialog
**/
static void
cb_dialog_cancel_clicked (GtkWidget *button, SortFlowState *state)
{
gtk_widget_destroy (state->dialog);
return;
}
static void
dialog_load_selection (SortFlowState *state)
{
char *name;
Range const *first;