[glabels/vala] Added page preview pane.
- From: Jim Evins <jimevins src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glabels/vala] Added page preview pane.
- Date: Sat, 31 Mar 2012 01:41:16 +0000 (UTC)
commit ae8db0b728cd853adc2535dbcafc94d945e4c00f
Author: Jim Evins <evins snaught com>
Date: Fri Mar 30 21:39:48 2012 -0400
Added page preview pane.
TODO | 38 +++++++--------------
data/ui/Makefile.am | 3 +-
data/ui/page_preview.ui | 72 ++++++++++++++++++++++++++++++++++++++++
glabels/Makefile.am | 1 +
glabels/mini_preview.vala | 12 +++++-
glabels/page_preview.vala | 81 +++++++++++++++++++++++++++++++++++++++++++++
glabels/window.vala | 38 ++++++++++----------
7 files changed, 198 insertions(+), 47 deletions(-)
---
diff --git a/TODO b/TODO
index 7fe8161..1df9f05 100644
--- a/TODO
+++ b/TODO
@@ -1,35 +1,23 @@
-Development plan
-----------------
-This development plan sets a specific set of milestones for future versions
-of glabels.
-
-
-Goals for 2.2.x:
-
- - Bugfixes
-
- - Translations
+Use Cases
+=========
+Case #1: one or more sheets of identical labels/cards. Examples: return address labels,
+ business cards, multiple copies of a CD label.
-Goals for 2.3.x (current development branch for 3.0):
+Case #2: Document merge from external data source. Each label has an identical design
+ but varies in the data that is pulled from the data source. Each data record
+ produces a unique label. Examples: address labels from an address list,
+ name tags.
- - Migrate to Gnome 3.0 platform
+Case #3: A sheet contains multiple sets of identical label/cards.
- - Remove deprecations from Gnome 2.0 platform
- - New color combo selector widget family
-
- - New font selector widget family
-
- - Undo, Redo capability
-
- - Allow for management of custom templates
- (i.e. delete, rename, edit).
-
- - Improve documentation and translation maintainance
+Development plan
+================
- - Code cleanup
+This development plan sets a specific set of milestones for future versions
+of glabels.
Possible Goals for future branches:
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 8963da8..3035a76 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -4,7 +4,8 @@ builderdir = $(datadir)/$(GLABELS_BRANCH)/ui/
builder_DATA = \
new_label_dialog.ui \
- object_editor.ui
+ object_editor.ui \
+ page_preview.ui
EXTRA_DIST = $(builder_DATA)
diff --git a/data/ui/page_preview.ui b/data/ui/page_preview.ui
new file mode 100644
index 0000000..c176c68
--- /dev/null
+++ b/data/ui/page_preview.ui
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window1">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="property_editor_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="border_width">6</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="title_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="title_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-print-preview</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"><b>Page preview</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="layout_preview_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkSizeGroup" id="page_sizegroup">
+ <property name="mode">both</property>
+ </object>
+ <object class="GtkSizeGroup" id="width_sizegroup"/>
+</interface>
diff --git a/glabels/Makefile.am b/glabels/Makefile.am
index 466ac0c..262cd7c 100644
--- a/glabels/Makefile.am
+++ b/glabels/Makefile.am
@@ -45,6 +45,7 @@ glabels_4_SOURCES = \
mini_preview.vala \
new_label_dialog.vala \
object_editor.vala \
+ page_preview.vala \
prefs.vala \
print.vala \
template_history.vala \
diff --git a/glabels/mini_preview.vala b/glabels/mini_preview.vala
index 49298e6..a2ddc30 100644
--- a/glabels/mini_preview.vala
+++ b/glabels/mini_preview.vala
@@ -61,8 +61,8 @@ namespace glabels
- public MiniPreview( int height,
- int width )
+ public MiniPreview( int width,
+ int height )
{
add_events( Gdk.EventMask.BUTTON_PRESS_MASK |
Gdk.EventMask.BUTTON_RELEASE_MASK |
@@ -85,6 +85,8 @@ namespace glabels
{
this.label = label;
set_template( label.template );
+
+ label.changed.connect( on_label_changed );
}
@@ -212,6 +214,12 @@ namespace glabels
}
+ private void on_label_changed()
+ {
+ redraw_canvas();
+ }
+
+
private void redraw_canvas()
{
var window = get_window ();
diff --git a/glabels/page_preview.vala b/glabels/page_preview.vala
new file mode 100644
index 0000000..1d0e00f
--- /dev/null
+++ b/glabels/page_preview.vala
@@ -0,0 +1,81 @@
+/* property_editor.vala
+ *
+ * Copyright (C) 2012 Jim Evins <evins snaught com>
+ *
+ * This file is part of gLabels.
+ *
+ * gLabels is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * gLabels 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 gLabels. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+using GLib;
+using libglabels;
+
+namespace glabels
+{
+
+ class PagePreview : Gtk.Box
+ {
+ private Label label;
+
+ private Gtk.Box title_box;
+ private Gtk.Box layout_preview_box;
+ private MiniPreview layout_preview;
+
+
+ public PagePreview()
+ {
+ /* Load the user interface. */
+ Gtk.Builder builder = new Gtk.Builder();
+ try
+ {
+ string file = GLib.Path.build_filename( Config.DATADIR, Config.GLABELS_BRANCH, "ui", "page_preview.ui" );
+ string[] objects = { "property_editor_vbox",
+ null };
+ builder.add_objects_from_file( file, objects );
+ }
+ catch ( Error err )
+ {
+ error( "Error: %s", err.message );
+ }
+
+ Gtk.VBox property_editor_vbox = builder.get_object( "property_editor_vbox" ) as Gtk.VBox;
+ pack_start( property_editor_vbox );
+
+ /* Title widgets. */
+ title_box = builder.get_object( "title_box" ) as Gtk.Box;
+ title_box.set_sensitive( false );
+
+ /* Layout widgets. */
+ layout_preview_box = builder.get_object( "layout_preview_box" ) as Gtk.Box;
+
+ layout_preview = new MiniPreview( 280, 420 );
+ layout_preview.show_all();
+ layout_preview_box.pack_start( layout_preview, true, true, 0 );
+ }
+
+
+ public void set_label( Label label )
+ {
+ this.label = label;
+
+ title_box.set_sensitive( true );
+ layout_preview.set_label( label );
+ }
+
+
+ }
+
+}
+
diff --git a/glabels/window.vala b/glabels/window.vala
index e349b73..2dcb555 100644
--- a/glabels/window.vala
+++ b/glabels/window.vala
@@ -27,8 +27,8 @@ namespace glabels
public class Window : Gtk.Window
{
- private const int DEFAULT_WINDOW_WIDTH = 788;
- private const int DEFAULT_WINDOW_HEIGHT = 600;
+ private const int DEFAULT_WINDOW_WIDTH = 1000;
+ private const int DEFAULT_WINDOW_HEIGHT = 700;
private const int ZOOM_INFO_WIDTH = 75;
private const int CURSOR_INFO_WIDTH = 150;
@@ -37,22 +37,23 @@ namespace glabels
public static unowned List<weak Window> window_list { get; private set; }
- private Gtk.HBox content_hbox;
+ private Gtk.HBox content_hbox;
- public View? view { get; private set; }
+ public View? view { get; private set; }
- public Gtk.Statusbar statusbar { get; private set; }
- private Gtk.Label zoom_info_label;
- private Gtk.Label cursor_info_label;
- public uint menu_tips_context_id { get; private set; }
+ public Gtk.Statusbar statusbar { get; private set; }
+ private Gtk.Label zoom_info_label;
+ private Gtk.Label cursor_info_label;
+ public uint menu_tips_context_id { get; private set; }
- private Gtk.Menu context_menu;
- private Gtk.Menu empty_selection_context_menu;
+ private Gtk.Menu context_menu;
+ private Gtk.Menu empty_selection_context_menu;
- private Prefs prefs;
- private Ui ui;
+ private Prefs prefs;
+ private Ui ui;
- private ObjectEditor object_editor;
+ private PagePreview page_preview;
+ private ObjectEditor object_editor;
public Window()
@@ -70,6 +71,10 @@ namespace glabels
Gtk.HBox main_hbox = new Gtk.HBox( false, 0 );
vbox1.pack_start( main_hbox, true, true, 0 );
+ page_preview = new PagePreview();
+ page_preview.set_hexpand( false );
+ main_hbox.pack_start( page_preview, false, false, 0 );
+
content_hbox = new Gtk.HBox( false, 0 );
content_hbox.set_hexpand( true );
main_hbox.pack_start( content_hbox, true, true, 0 );
@@ -155,12 +160,7 @@ namespace glabels
label.modified = false;
set_window_title( label );
-/*
- MiniPreview mini_preview = new MiniPreview( 200, 200 );
- mini_preview.set_label( label );
- mini_preview.show_all();
- content_hbox.pack_start( mini_preview, true, true, 0 );
-*/
+ page_preview.set_label( label );
object_editor.set_label( label );
view = new View( label );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]