[pdfmod] Massive reorganization of src/



commit 4eeeebfe2986305e4f4cff9a614b6aef358061ee
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Aug 11 14:06:12 2009 -0700

    Massive reorganization of src/
    
    New directory structure, and split PdfMod class out into Main,
    Core.Client, and Gui.Client.

 .gitignore                                         |    4 +-
 Makefile.am                                        |    4 +-
 PdfMod.mds                                         |    4 +-
 configure.ac                                       |    8 +-
 lib/PdfSharp/Makefile.am                           |   12 +-
 po/POTFILES.in                                     |   16 +-
 po/POTFILES.skip                                   |    4 +-
 src/{PdfMod => }/Makefile.am                       |  114 ++++++++-------
 src/{PdfMod => }/PdfMod.exe.config                 |    0
 src/{PdfMod => }/PdfMod.mdp                        |   58 ++++----
 src/PdfMod/{PdfMod => Core}/AssemblyInfo.cs        |    0
 src/PdfMod/Core/Client.cs                          |   99 +++++++++++++
 src/PdfMod/{PdfMod => Core}/Configuration.cs       |    4 +-
 src/PdfMod/{PdfMod => Core}/Defines.cs.in          |    2 +-
 .../{PdfMod/GlobalActions.cs => Gui/Actions.cs}    |   55 ++-----
 .../CellRendererCairo.cs => Gui/CairoCell.cs}      |    6 +-
 src/PdfMod/{PdfMod/PdfMod.cs => Gui/Client.cs}     |  151 +++++---------------
 .../{PdfMod/PdfIconView.cs => Gui/DocumentView.cs} |   25 ++--
 .../{PdfMod/PdfListStore.cs => Gui/ListStore.cs}   |    4 +-
 src/PdfMod/{PdfMod => Gui}/MetadataEditorBox.cs    |   10 +-
 .../CellRendererPage.cs => Gui/PageCell.cs}        |   10 +-
 .../QueryBox.cs => Gui/SelectMatchingBox.cs}       |    6 +-
 src/PdfMod/Main.cs                                 |   35 +++++
 .../Actions}/BasePageAction.cs                     |    2 +-
 .../Actions}/ExportImagesAction.cs                 |    2 +-
 .../{PdfMod.Actions => Pdf/Actions}/MoveAction.cs  |    4 +-
 .../Actions}/RemoveAction.cs                       |    2 +-
 .../Actions}/RotateAction.cs                       |    4 +-
 src/PdfMod/{PdfMod => Pdf}/Document.cs             |   36 ++++-
 src/PdfMod/{PdfMod => Pdf}/Page.cs                 |    2 +-
 src/PdfMod/{PdfMod => Pdf}/PageLabels.cs           |    2 +-
 src/PdfMod/{PdfMod => Pdf}/PageThumbnail.cs        |    2 +-
 src/{PdfMod => }/Resources/UIManager.xml           |    0
 src/{PdfMod => }/pdfmod.in                         |    0
 34 files changed, 378 insertions(+), 309 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9d13247..d5006cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,8 +40,8 @@ po/Makefile.in.in
 po/stamp-it
 data/pdfmod.desktop
 data/pdfmod.desktop.in
-src/PdfMod/pdfmod
-src/PdfMod/PdfMod/Defines.cs
+src/pdfmod
+src/PdfMod/Core/Defines.cs
 *.resources
 gnome-doc-utils.make
 docs/*/.xml2po.mo
diff --git a/Makefile.am b/Makefile.am
index a3062a9..a3694f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,10 +2,10 @@
 
 #Warning: This is an automatically generated file, do not edit!
 if ENABLE_DEBUG
- SUBDIRS =  src/Libraries/PdfSharp src/PdfMod po docs data
+ SUBDIRS =  lib/PdfSharp src po docs data
 endif
 if ENABLE_RELEASE
- SUBDIRS =  src/Libraries/PdfSharp src/PdfMod po docs data
+ SUBDIRS =  lib/PdfSharp src po docs data
 endif
 
 run:
diff --git a/PdfMod.mds b/PdfMod.mds
index f48e942..376ebde 100644
--- a/PdfMod.mds
+++ b/PdfMod.mds
@@ -18,7 +18,7 @@
     <Execute type="None" entry="PdfSharp" />
   </StartMode>
   <Entries>
-    <Entry filename="src/PdfMod/PdfMod.mdp" />
-    <Entry filename="src/Libraries/PdfSharp/PdfSharp.csproj" />
+    <Entry filename="src/PdfMod.mdp" />
+    <Entry filename="lib/PdfSharp/PdfSharp.csproj" />
   </Entries>
 </Combine>
diff --git a/configure.ac b/configure.ac
index 4bbe7ca..7b94a14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,10 +123,10 @@ docs/Makefile
 data/Makefile
 data/pdfmod.desktop.in
 data/icons/Makefile
-src/Libraries/PdfSharp/Makefile
-src/PdfMod/PdfMod/Defines.cs
-src/PdfMod/pdfmod
-src/PdfMod/Makefile
+lib/PdfSharp/Makefile
+src/PdfMod/Core/Defines.cs
+src/pdfmod
+src/Makefile
 Makefile
 
 ])
diff --git a/lib/PdfSharp/Makefile.am b/lib/PdfSharp/Makefile.am
index 4536963..e3bf5a9 100644
--- a/lib/PdfSharp/Makefile.am
+++ b/lib/PdfSharp/Makefile.am
@@ -6,26 +6,26 @@ EXTRA_DIST =
 if ENABLE_DEBUG
 ASSEMBLY_COMPILER_COMMAND = gmcs
 ASSEMBLY_COMPILER_FLAGS =  -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:TRACE;DEBUG;GDI;UseGdiObjects"
-ASSEMBLY = ../../../bin/PdfSharp.dll
+ASSEMBLY = ../../bin/PdfSharp.dll
 ASSEMBLY_MDB = $(ASSEMBLY).mdb
 COMPILE_TARGET = library
 PROJECT_REFERENCES = 
-BUILD_DIR = ../../../bin
+BUILD_DIR = ../../bin
 
-PDFSHARP_DLL_MDB_SOURCE=../../../bin/PdfSharp.dll.mdb
+PDFSHARP_DLL_MDB_SOURCE=../../bin/PdfSharp.dll.mdb
 
 endif
 
 if ENABLE_RELEASE
 ASSEMBLY_COMPILER_COMMAND = gmcs
 ASSEMBLY_COMPILER_FLAGS =  -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:TRACE;GDI;DEBUG;UseGdiObjects"
-ASSEMBLY = ../../../bin/PdfSharp.dll
+ASSEMBLY = ../../bin/PdfSharp.dll
 ASSEMBLY_MDB = $(ASSEMBLY).mdb
 COMPILE_TARGET = library
 PROJECT_REFERENCES = 
-BUILD_DIR = ../../../bin
+BUILD_DIR = ../../bin
 
-PDFSHARP_DLL_MDB_SOURCE=../../../bin/PdfSharp.dll.mdb
+PDFSHARP_DLL_MDB_SOURCE=../../bin/PdfSharp.dll.mdb
 
 endif
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4fba93e..ca6fe34 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,11 +2,11 @@
 [encoding: UTF-8]
 
 data/pdfmod.desktop.in.in
-src/PdfMod/PdfMod.Actions/ExportImagesAction.cs
-src/PdfMod/PdfMod.Actions/MoveAction.cs
-src/PdfMod/PdfMod.Actions/RemoveAction.cs
-src/PdfMod/PdfMod/GlobalActions.cs
-src/PdfMod/PdfMod/PdfListStore.cs
-src/PdfMod/PdfMod/PdfMod.cs
-src/PdfMod/PdfMod/QueryBox.cs
-src/PdfMod/PdfMod/MetadataEditorBox.cs
+src/PdfMod/Pdf/Actions/ExportImagesAction.cs
+src/PdfMod/Pdf/Actions/MoveAction.cs
+src/PdfMod/Pdf/Actions/RemoveAction.cs
+src/PdfMod/Gui/Actions.cs
+src/PdfMod/Gui/ListStore.cs
+src/PdfMod/Gui/Client.cs
+src/PdfMod/Gui/SelectMatchingBox.cs
+src/PdfMod/Gui/MetadataEditorBox.cs
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index df25682..13b1405 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,3 +1,3 @@
-src/Libraries/PdfSharp/PdfSharp.Pdf.IO/Parser.cs
-src/Libraries/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs
+lib/PdfSharp/PdfSharp.Pdf.IO/Parser.cs
+lib/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs
 data/pdfmod.desktop.in
diff --git a/src/PdfMod/Makefile.am b/src/Makefile.am
similarity index 59%
rename from src/PdfMod/Makefile.am
rename to src/Makefile.am
index 827e964..1c0e889 100644
--- a/src/PdfMod/Makefile.am
+++ b/src/Makefile.am
@@ -6,49 +6,49 @@ EXTRA_DIST =
 if ENABLE_DEBUG
 ASSEMBLY_COMPILER_COMMAND = gmcs
 ASSEMBLY_COMPILER_FLAGS =  -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:DEBUG"
-ASSEMBLY = ../../bin/PdfMod.exe
+ASSEMBLY = ../bin/PdfMod.exe
 ASSEMBLY_MDB = $(ASSEMBLY).mdb
 COMPILE_TARGET = exe
-PROJECT_REFERENCES = ../../bin/PdfSharp.dll
-BUILD_DIR = ../../bin
-
-PDFSHARP_DLL_SOURCE=../../bin/PdfSharp.dll
-PDFSHARP_DLL_MDB_SOURCE=../../bin/PdfSharp.dll.mdb
-HYENA_DLL_SOURCE=../../lib/Hyena.dll
-HYENA_DLL_MDB_SOURCE=../../lib/Hyena.dll.mdb
-MONO_DATA_SQLITE_DLL_SOURCE=../../lib/Mono.Data.Sqlite.dll
-MONO_DATA_SQLITE_DLL_MDB_SOURCE=../../lib/Mono.Data.Sqlite.dll.mdb
-HYENA_GUI_DLL_SOURCE=../../lib/Hyena.Gui.dll
-HYENA_GUI_DLL_CONFIG_SOURCE=../../lib/Hyena.Gui.dll.config
-HYENA_GUI_DLL_MDB_SOURCE=../../lib/Hyena.Gui.dll.mdb
-POPPLER_SHARP_DLL_SOURCE=../../lib/poppler-sharp.dll
-POPPLER_SHARP_DLL_CONFIG_SOURCE=../../lib/poppler-sharp.dll.config
-PDFMOD_EXE_MDB_SOURCE=../../bin/PdfMod.exe.mdb
+PROJECT_REFERENCES = ../bin/PdfSharp.dll
+BUILD_DIR = ../bin
+
+PDFSHARP_DLL_SOURCE=../bin/PdfSharp.dll
+PDFSHARP_DLL_MDB_SOURCE=../bin/PdfSharp.dll.mdb
+HYENA_DLL_SOURCE=../lib/Hyena.dll
+HYENA_DLL_MDB_SOURCE=../lib/Hyena.dll.mdb
+MONO_DATA_SQLITE_DLL_SOURCE=../lib/Mono.Data.Sqlite.dll
+MONO_DATA_SQLITE_DLL_MDB_SOURCE=../lib/Mono.Data.Sqlite.dll.mdb
+HYENA_GUI_DLL_SOURCE=../lib/Hyena.Gui.dll
+HYENA_GUI_DLL_CONFIG_SOURCE=../lib/Hyena.Gui.dll.config
+HYENA_GUI_DLL_MDB_SOURCE=../lib/Hyena.Gui.dll.mdb
+POPPLER_SHARP_DLL_SOURCE=../lib/poppler-sharp.dll
+POPPLER_SHARP_DLL_CONFIG_SOURCE=../lib/poppler-sharp.dll.config
+PDFMOD_EXE_MDB_SOURCE=../bin/PdfMod.exe.mdb
 
 endif
 
 if ENABLE_RELEASE
 ASSEMBLY_COMPILER_COMMAND = gmcs
 ASSEMBLY_COMPILER_FLAGS =  -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG
-ASSEMBLY = ../../bin/PdfMod.exe
+ASSEMBLY = ../bin/PdfMod.exe
 ASSEMBLY_MDB = $(ASSEMBLY).mdb
 COMPILE_TARGET = exe
 PROJECT_REFERENCES =  \
-	../../bin/PdfSharp.dll
-BUILD_DIR = ../../bin
-
-PDFSHARP_DLL_SOURCE=../../bin/PdfSharp.dll
-PDFSHARP_DLL_MDB_SOURCE=../../bin/PdfSharp.dll.mdb
-HYENA_DLL_SOURCE=../../lib/Hyena.dll
-HYENA_DLL_MDB_SOURCE=../../lib/Hyena.dll.mdb
-MONO_DATA_SQLITE_DLL_SOURCE=../../lib/Mono.Data.Sqlite.dll
-MONO_DATA_SQLITE_DLL_MDB_SOURCE=../../lib/Mono.Data.Sqlite.dll.mdb
-HYENA_GUI_DLL_SOURCE=../../lib/Hyena.Gui.dll
-HYENA_GUI_DLL_CONFIG_SOURCE=../../lib/Hyena.Gui.dll.config
-HYENA_GUI_DLL_MDB_SOURCE=../../lib/Hyena.Gui.dll.mdb
-POPPLER_SHARP_DLL_SOURCE=../../lib/poppler-sharp.dll
-POPPLER_SHARP_DLL_CONFIG_SOURCE=../../lib/poppler-sharp.dll.config
-PDFMOD_EXE_MDB_SOURCE=../../bin/PdfMod.exe.mdb
+	../bin/PdfSharp.dll
+BUILD_DIR = ../bin
+
+PDFSHARP_DLL_SOURCE=../bin/PdfSharp.dll
+PDFSHARP_DLL_MDB_SOURCE=../bin/PdfSharp.dll.mdb
+HYENA_DLL_SOURCE=../lib/Hyena.dll
+HYENA_DLL_MDB_SOURCE=../lib/Hyena.dll.mdb
+MONO_DATA_SQLITE_DLL_SOURCE=../lib/Mono.Data.Sqlite.dll
+MONO_DATA_SQLITE_DLL_MDB_SOURCE=../lib/Mono.Data.Sqlite.dll.mdb
+HYENA_GUI_DLL_SOURCE=../lib/Hyena.Gui.dll
+HYENA_GUI_DLL_CONFIG_SOURCE=../lib/Hyena.Gui.dll.config
+HYENA_GUI_DLL_MDB_SOURCE=../lib/Hyena.Gui.dll.mdb
+POPPLER_SHARP_DLL_SOURCE=../lib/poppler-sharp.dll
+POPPLER_SHARP_DLL_CONFIG_SOURCE=../lib/poppler-sharp.dll.config
+PDFMOD_EXE_MDB_SOURCE=../bin/PdfMod.exe.mdb
 
 endif
 
@@ -78,26 +78,28 @@ RESGEN=resgen2
 all: $(ASSEMBLY) $(PROGRAMFILES) $(BINARIES) 
 
 FILES =  \
-	PdfMod.Actions/BasePageAction.cs \
-	PdfMod.Actions/ExportImagesAction.cs \
-	PdfMod.Actions/MoveAction.cs \
-	PdfMod.Actions/RemoveAction.cs \
-	PdfMod.Actions/RotateAction.cs \
-	PdfMod/AssemblyInfo.cs \
-	PdfMod/CellRendererCairo.cs \
-	PdfMod/CellRendererPage.cs \
-	PdfMod/Configuration.cs \
-	PdfMod/Defines.cs \
-	PdfMod/Document.cs \
-	PdfMod/GlobalActions.cs \
-	PdfMod/MetadataEditorBox.cs \
-	PdfMod/Page.cs \
-	PdfMod/PageLabels.cs \
-	PdfMod/PageThumbnail.cs \
-	PdfMod/PdfIconView.cs \
-	PdfMod/PdfListStore.cs \
-	PdfMod/PdfMod.cs \
-	PdfMod/QueryBox.cs 
+	PdfMod/Core/AssemblyInfo.cs \
+	PdfMod/Core/Client.cs \
+	PdfMod/Core/Configuration.cs \
+	PdfMod/Core/Defines.cs \
+	PdfMod/Gui/Actions.cs \
+	PdfMod/Gui/CairoCell.cs \
+	PdfMod/Gui/Client.cs \
+	PdfMod/Gui/DocumentView.cs \
+	PdfMod/Gui/ListStore.cs \
+	PdfMod/Gui/MetadataEditorBox.cs \
+	PdfMod/Gui/PageCell.cs \
+	PdfMod/Gui/SelectMatchingBox.cs \
+	PdfMod/Main.cs \
+	PdfMod/Pdf/Actions/BasePageAction.cs \
+	PdfMod/Pdf/Actions/ExportImagesAction.cs \
+	PdfMod/Pdf/Actions/MoveAction.cs \
+	PdfMod/Pdf/Actions/RemoveAction.cs \
+	PdfMod/Pdf/Actions/RotateAction.cs \
+	PdfMod/Pdf/Document.cs \
+	PdfMod/Pdf/Page.cs \
+	PdfMod/Pdf/PageLabels.cs \
+	PdfMod/Pdf/PageThumbnail.cs 
 
 DATA_FILES = 
 
@@ -119,10 +121,10 @@ REFERENCES =  \
 	System.Drawing
 
 DLL_REFERENCES =  \
-	../../lib/Hyena.dll \
-	../../lib/Hyena.Gui.dll \
-	../../lib/Mono.Data.Sqlite.dll \
-	../../lib/poppler-sharp.dll
+	../lib/Hyena.dll \
+	../lib/Hyena.Gui.dll \
+	../lib/Mono.Data.Sqlite.dll \
+	../lib/poppler-sharp.dll
 
 CLEANFILES = $(PROGRAMFILES) $(BINARIES)
 
diff --git a/src/PdfMod/PdfMod.exe.config b/src/PdfMod.exe.config
similarity index 100%
rename from src/PdfMod/PdfMod.exe.config
rename to src/PdfMod.exe.config
diff --git a/src/PdfMod/PdfMod.mdp b/src/PdfMod.mdp
similarity index 68%
rename from src/PdfMod/PdfMod.mdp
rename to src/PdfMod.mdp
index 908bae8..7f16fb0 100644
--- a/src/PdfMod/PdfMod.mdp
+++ b/src/PdfMod.mdp
@@ -4,14 +4,14 @@
   </Policies>
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="DotNetProjectConfiguration">
-      <Output directory="../../bin/" assembly="PdfMod" />
+      <Output directory="../bin/" assembly="PdfMod" />
       <Build debugmode="True" target="Exe" />
       <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
       <EnvironmentVariables />
       <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
     </Configuration>
     <Configuration name="Release" ctype="DotNetProjectConfiguration">
-      <Output directory="../../bin/" assembly="PdfMod" />
+      <Output directory="../bin/" assembly="PdfMod" />
       <Build debugmode="True" target="Exe" />
       <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
       <EnvironmentVariables />
@@ -19,28 +19,30 @@
     </Configuration>
   </Configurations>
   <Contents>
-    <File name="PdfMod/PdfMod.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/PdfIconView.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/PdfListStore.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/GlobalActions.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Main.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Core/AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/DocumentView.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/ListStore.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/Actions.cs" subtype="Code" buildaction="Compile" />
     <File name="Resources/UIManager.xml" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="PdfMod.Actions/RemoveAction.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/Document.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/Page.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod.Actions/RotateAction.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod.Actions/BasePageAction.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod.Actions/ExportImagesAction.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/QueryBox.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/CellRendererCairo.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/CellRendererPage.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod.Actions/MoveAction.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/MetadataEditorBox.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/PageThumbnail.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/PageLabels.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/Defines.cs.in" subtype="Code" buildaction="Nothing" />
-    <File name="PdfMod/Defines.cs" subtype="Code" buildaction="Compile" />
-    <File name="PdfMod/Configuration.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Actions/RemoveAction.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Document.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Page.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Actions/RotateAction.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Actions/BasePageAction.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Actions/ExportImagesAction.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/SelectMatchingBox.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/CairoCell.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/PageCell.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/Client.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/Actions/MoveAction.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Gui/MetadataEditorBox.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/PageThumbnail.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Core/Defines.cs.in" subtype="Code" buildaction="Nothing" />
+    <File name="PdfMod/Core/Defines.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Core/Client.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Core/Configuration.cs" subtype="Code" buildaction="Compile" />
+    <File name="PdfMod/Pdf/PageLabels.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
@@ -55,15 +57,15 @@
     <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <ProjectReference type="Project" localcopy="True" refto="PdfSharp" />
-    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../lib/Hyena.dll" />
-    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../lib/Mono.Data.Sqlite.dll" />
-    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../lib/Hyena.Gui.dll" />
-    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../lib/poppler-sharp.dll" />
+    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../lib/Hyena.dll" />
+    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../lib/Mono.Data.Sqlite.dll" />
+    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../lib/Hyena.Gui.dll" />
+    <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../lib/poppler-sharp.dll" />
     <ProjectReference type="Gac" localcopy="True" refto="gnome-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <ProjectReference type="Gac" localcopy="True" refto="gconf-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
   </References>
   <GtkDesignInfo gettextClass="Mono.Posix.Catalog" />
-  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../..">
+  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="..">
     <BuildFilesVar Sync="True" Name="FILES" />
     <DeployFilesVar />
     <ResourcesVar Sync="True" Name="RESOURCES" />
diff --git a/src/PdfMod/PdfMod/AssemblyInfo.cs b/src/PdfMod/Core/AssemblyInfo.cs
similarity index 100%
rename from src/PdfMod/PdfMod/AssemblyInfo.cs
rename to src/PdfMod/Core/AssemblyInfo.cs
diff --git a/src/PdfMod/Core/Client.cs b/src/PdfMod/Core/Client.cs
new file mode 100644
index 0000000..6b5b667
--- /dev/null
+++ b/src/PdfMod/Core/Client.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+using Mono.Unix;
+
+using Hyena;
+
+using PdfMod.Pdf;
+
+namespace PdfMod.Core
+{
+    public abstract class Client
+    {
+        private static readonly string old_cache_dir = Path.Combine (System.Environment.GetFolderPath (System.Environment.SpecialFolder.ApplicationData), "pdfmod");
+        private static readonly string CacheDir = Path.Combine (XdgBaseDirectorySpec.GetUserDirectory ("XDG_CACHE_HOME", ".cache"), "pdfmod");
+
+        public Document Document { get; protected set; }
+        public static Configuration Configuration { get; private set; }
+
+        public event EventHandler DocumentLoaded;
+
+        static Client ()
+        {
+            Configuration = new Configuration ();
+            InitCache ();
+        }
+
+        public Client ()
+        {
+        }
+
+        protected void OnDocumentLoaded ()
+        {
+            var handler = DocumentLoaded;
+            if (handler != null) {
+                handler (this, EventArgs.Empty);
+            }
+        }
+
+        protected void LoadFiles ()
+        {
+            // This variable should probably be marked volatile
+            Hyena.Log.Debugging = true;
+            LoadFiles (ApplicationContext.CommandLine.Files);
+        }
+
+        protected abstract void LoadFiles (IList<string> files);
+
+        public void LoadPath (string path)
+        {
+            LoadPath (path, null);
+        }
+
+        public abstract void LoadPath (string path, string suggestedFilename);
+
+        private static void InitCache ()
+        {
+            // Remove the old "cache" dir that really ended up being ~/.config/
+            if (Directory.Exists (old_cache_dir)) {
+                try {
+                    Directory.Delete (old_cache_dir);
+                } catch {}
+            }
+
+            // Make sure the new one exists
+            try {
+                Directory.CreateDirectory (CacheDir);
+                Log.DebugFormat ("Cache directory set to {0}", CacheDir);
+
+                // Remove any tmp files that haven't been touched in three days
+                var too_old = DateTime.Now;
+                too_old.AddDays (-3);
+                foreach (string file in Directory.GetFiles (CacheDir)) {
+                    if (file.Contains ("tmpfile-")) {
+                        if (File.GetLastAccessTime (file) < too_old) {
+                            File.Delete (file);
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                Log.Exception (String.Format ("Unable to create cache directory: {0}", CacheDir), e);
+            }
+        }
+
+        public static string GetTmpFilename ()
+        {
+            string filename = null;
+            int i = 0;
+            while (filename == null) {
+                filename = Path.Combine (CacheDir, "tmpfile-" + i++);
+                if (File.Exists (filename)) {
+                    filename = null;
+                }
+            }
+            return filename;
+        }
+    }
+}
diff --git a/src/PdfMod/PdfMod/Configuration.cs b/src/PdfMod/Core/Configuration.cs
similarity index 97%
rename from src/PdfMod/PdfMod/Configuration.cs
rename to src/PdfMod/Core/Configuration.cs
index a41116e..044e959 100644
--- a/src/PdfMod/PdfMod/Configuration.cs
+++ b/src/PdfMod/Core/Configuration.cs
@@ -1,7 +1,7 @@
 
 using System;
 
-namespace PdfMod
+namespace PdfMod.Core
 {    
     public class Configuration
     {
@@ -36,4 +36,4 @@ namespace PdfMod
             set { Set<string> ("last_folder", value); }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/PdfMod/PdfMod/Defines.cs.in b/src/PdfMod/Core/Defines.cs.in
similarity index 85%
rename from src/PdfMod/PdfMod/Defines.cs.in
rename to src/PdfMod/Core/Defines.cs.in
index b8ae81b..67dafe4 100644
--- a/src/PdfMod/PdfMod/Defines.cs.in
+++ b/src/PdfMod/Core/Defines.cs.in
@@ -1,6 +1,6 @@
 using System;
 
-namespace PdfMod
+namespace PdfMod.Core
 {
 	public class Defines
 	{
diff --git a/src/PdfMod/PdfMod/GlobalActions.cs b/src/PdfMod/Gui/Actions.cs
similarity index 89%
rename from src/PdfMod/PdfMod/GlobalActions.cs
rename to src/PdfMod/Gui/Actions.cs
index b33a5ed..e4236d8 100644
--- a/src/PdfMod/PdfMod/GlobalActions.cs
+++ b/src/PdfMod/Gui/Actions.cs
@@ -13,13 +13,14 @@ using Hyena.Gui;
 
 using PdfSharp.Pdf;
 
-using PdfMod.Actions;
+using PdfMod.Pdf;
+using PdfMod.Pdf.Actions;
 
-namespace PdfMod
+namespace PdfMod.Gui
 {
-    public class GlobalActions : HyenaActionGroup
+    public class Actions : HyenaActionGroup
     {
-        private PdfMod app;
+        private Client app;
         private UndoManager undo_manager;
         private const string WIKI_URL = "http://live.gnome.org/PdfMod";;
 
@@ -36,7 +37,7 @@ namespace PdfMod
             get { return undo_manager; }
         }
 
-        public GlobalActions (PdfMod app, ActionManager action_manager) : base (action_manager, "Global")
+        public Actions (Client app, ActionManager action_manager) : base (action_manager, "Global")
         {
             this.app = app;
             undo_manager = new UndoManager ();
@@ -80,7 +81,7 @@ namespace PdfMod
             AddImportant (
                 new ToggleActionEntry ("Properties", Stock.Properties, null, "<alt>Return", Catalog.GetString ("View and edit the title, keywords, and more for this document"), OnProperties, false),
                 new ToggleActionEntry ("ZoomFit", Stock.ZoomFit, null, "<control>0", null, OnZoomFit, true),
-                new ToggleActionEntry ("ViewToolbar", null, Catalog.GetString ("Toolbar"), null, null, OnViewToolbar, PdfMod.Configuration.ShowToolbar)
+                new ToggleActionEntry ("ViewToolbar", null, Catalog.GetString ("Toolbar"), null, null, OnViewToolbar, Client.Configuration.ShowToolbar)
             );
 
             this["RotateRight"].IconName = "object-rotate-right";
@@ -126,7 +127,7 @@ namespace PdfMod
             };
             recent_chooser_item.Filter.AddPattern ("*.pdf");
             recent_chooser_item.ItemActivated += delegate {
-                PdfMod.RunIdle (delegate { app.LoadPath (recent_chooser_item.CurrentUri); });
+                Client.RunIdle (delegate { app.LoadPath (recent_chooser_item.CurrentUri); });
             };
             recent_item.Submenu = recent_chooser_item;
         }
@@ -192,7 +193,7 @@ namespace PdfMod
             if (app.Document != null) {
                 chooser.SetCurrentFolder (System.IO.Path.GetDirectoryName (app.Document.SuggestedSavePath));
             } else {
-                chooser.SetCurrentFolder (PdfMod.Configuration.LastOpenFolder);
+                chooser.SetCurrentFolder (Client.Configuration.LastOpenFolder);
             }
 
             var response = chooser.Run ();
@@ -200,7 +201,7 @@ namespace PdfMod
             chooser.Destroy ();
 
             if (response == (int)ResponseType.Ok) {
-                PdfMod.RunIdle (delegate { app.LoadPath (filename); });
+                Client.RunIdle (delegate { app.LoadPath (filename); });
             }
         }
 
@@ -283,42 +284,18 @@ namespace PdfMod
                 doc.AddPage (page.Pdf);
             }
 
-            var path = PdfMod.GetTmpFilename ();
+            var path = Client.GetTmpFilename ();
             doc.Save (path);
             doc.Dispose ();
 
             app.LoadPath (path, Path.Combine (
                 Path.GetDirectoryName (app.Document.SuggestedSavePath),
                 String.Format ("[{0}] {1}",
-                    GLib.Markup.EscapeText (GetPageSummary (pages, 10)),
+                    GLib.Markup.EscapeText (Document.GetPageSummary (pages, 10)),
                     Path.GetFileName (app.Document.SuggestedSavePath))
             ));
         }
 
-        // Return a simple, nice string describing the selected pages
-        //   e.g.  Page 1, or Page 3 - 6, or Page 2, 4, 6
-        public static string GetPageSummary (List<Page> pages, int maxListed)
-        {
-            string pages_summary = null;
-            if (pages.Count == 1) {
-                // Translators: {0} is the number of pages (always 1), and {1} is the page number, eg Page 1, or Page 5
-                pages_summary = String.Format (Catalog.GetPluralString ("Page {1}", "Page {1}", pages.Count), pages.Count, pages[0].Index + 1);
-            } else if (pages[0].Index + pages.Count - 1 == pages[pages.Count - 1].Index) {
-                // Translators: {0} is the number of pages, and {1} is the first page, {2} is the last page,
-                // eg Pages 3 - 7
-                pages_summary = String.Format (Catalog.GetPluralString ("Pages {1} - {2}", "Pages {1} - {2}", pages.Count),
-                    pages.Count, pages[0].Index + 1, pages[pages.Count - 1].Index + 1);
-            } else if (pages.Count < maxListed) {
-                string page_nums = String.Join (", ", pages.Select (p => (p.Index + 1).ToString ()).ToArray ());
-                // Translators: {0} is the number of pages, {1} is a comma separated list of page numbers, eg Pages 1, 4, 9
-                pages_summary = String.Format (Catalog.GetPluralString ("Pages {1}", "Pages {1}", pages.Count), pages.Count, page_nums);
-            } else {
-                // Translators: {0} is the number of pages, eg 12 Pages
-                pages_summary = String.Format (Catalog.GetPluralString ("{0} Page", "{0} Pages", pages.Count), pages.Count);
-            }
-            return pages_summary;
-        }
-
         private void OnExportImages (object o, EventArgs args)
         {
             var action = new ExportImagesAction (app.Document, app.Document.Pages);
@@ -380,7 +357,7 @@ namespace PdfMod
                 var langs = GLib.Marshaller.NullTermPtrToStringArray (lang_ptr, false);
 
                 string help_dir = null;
-                foreach (var dir in new string [] { Defines.PREFIX + "/share/gnome/help/", "/usr/local/share/gnome/help/", "docs/" }) {
+                foreach (var dir in new string [] { Core.Defines.PREFIX + "/share/gnome/help/", "/usr/local/share/gnome/help/", "docs/" }) {
                     help_dir = dir;
                     if (System.IO.Directory.Exists (dir + "pdfmod/")) {
                         break;
@@ -422,7 +399,7 @@ namespace PdfMod
 
             var dialog = new Gtk.AboutDialog () {
                 ProgramName = "PDF Mod",
-                Version = Defines.VERSION,
+                Version = Core.Defines.VERSION,
                 Website = WIKI_URL,
                 WebsiteLabel = Catalog.GetString ("Visit Website"),
                 Authors = new string [] {
@@ -448,7 +425,7 @@ namespace PdfMod
             } catch {}
 
             string [] license_paths = new string [] {
-                Defines.PREFIX + "/share/doc/packages/pdfmod/COPYING",
+                Core.Defines.PREFIX + "/share/doc/packages/pdfmod/COPYING",
                 "/usr/local/share/doc/packages/pdfmod/COPYING",
                 "COPYING"
             };
@@ -507,7 +484,7 @@ namespace PdfMod
         private void OnViewToolbar (object o, EventArgs args)
         {
             bool show = (this["ViewToolbar"] as ToggleAction).Active;
-            PdfMod.Configuration.ShowToolbar = app.HeaderToolbar.Visible = show;
+            Client.Configuration.ShowToolbar = app.HeaderToolbar.Visible = show;
         }
 
         private void OnRotateRight (object o, EventArgs args)
diff --git a/src/PdfMod/PdfMod/CellRendererCairo.cs b/src/PdfMod/Gui/CairoCell.cs
similarity index 93%
rename from src/PdfMod/PdfMod/CellRendererCairo.cs
rename to src/PdfMod/Gui/CairoCell.cs
index e0960a8..99e8c5a 100644
--- a/src/PdfMod/PdfMod/CellRendererCairo.cs
+++ b/src/PdfMod/Gui/CairoCell.cs
@@ -7,13 +7,13 @@ using Cairo;
 using Hyena.Gui;
 using Hyena.Gui.Theming;
 
-namespace PdfMod
+namespace PdfMod.Gui
 {
-    public abstract class CellRendererCairo : CellRenderer
+    public abstract class CairoCell : CellRenderer
     {
         protected Theme Theme { get; private set; }
 
-        public CellRendererCairo ()
+        public CairoCell ()
         {
             Mode = CellRendererMode.Inert;
             Xpad = Ypad = 0;
diff --git a/src/PdfMod/PdfMod/PdfMod.cs b/src/PdfMod/Gui/Client.cs
similarity index 74%
rename from src/PdfMod/PdfMod/PdfMod.cs
rename to src/PdfMod/Gui/Client.cs
index 0347867..675bee9 100644
--- a/src/PdfMod/PdfMod/PdfMod.cs
+++ b/src/PdfMod/Gui/Client.cs
@@ -1,8 +1,9 @@
 using System;
+using System.Collections.Generic;
 using System.IO;
 
-using Mono.Unix;
 using Gtk;
+using Mono.Unix;
 
 using Hyena;
 using Hyena.Gui;
@@ -11,62 +12,45 @@ using PdfSharp;
 using PdfSharp.Pdf;
 using PdfSharp.Pdf.IO;
 
-namespace PdfMod
+using PdfMod.Pdf;
+
+namespace PdfMod.Gui
 {
-    public class PdfMod
+    public class Client : Core.Client
     {
         private static int app_count = 0;
 
-        private static readonly string old_cache_dir = Path.Combine (System.Environment.GetFolderPath (System.Environment.SpecialFolder.ApplicationData), "pdfmod");
-        private static readonly string CacheDir = Path.Combine (XdgBaseDirectorySpec.GetUserDirectory ("XDG_CACHE_HOME", ".cache"), "pdfmod");
-
-        public static void Main (string[] args)
-        {
-            ApplicationContext.TrySetProcessName ("pdfmod");
-
-            Gtk.Application.Init (null, ref args);
-            Gdk.Global.ProgramClass = "pdfmod";
-
-            Configuration = new Configuration ();
-            ThreadAssist.InitializeMainThread ();
-            ThreadAssist.ProxyToMainHandler = RunIdle;
-
-            Hyena.Log.Debugging = true;
-            Hyena.Log.Notify += OnLogNotify;
-            Hyena.Log.DebugFormat ("Starting PdfMod");
-
-            InitCatalog ("/usr/local/share/locale/", Defines.PREFIX + "/share/locale/");
-            InitCache ();
-
-            var app = new PdfMod ();
-            RunIdle (app.LoadFiles);
-
-            Application.Run ();
-        }
-
-        private MenuBar menu_bar;
+        private Gtk.MenuBar menu_bar;
         private Gtk.Label status_label;
         private QueryBox query_box;
 
         public ActionManager ActionManager { get; private set; }
-        public Toolbar HeaderToolbar;
-        public GlobalActions GlobalActions { get; private set; }
+        public Gtk.Toolbar HeaderToolbar;
+        public Actions Actions { get; private set; }
         public Gtk.Statusbar StatusBar { get; private set; }
         public Gtk.Window Window { get; private set; }
-        public PdfIconView IconView { get; private set; }
-        public Document Document { get; private set; }
+        public DocumentView IconView { get; private set; }
         public MetadataEditorBox EditorBox { get; private set; }
-        public static Configuration Configuration { get; private set; }
 
-        public event EventHandler DocumentLoaded;
+        static Client ()
+        {
+            Gtk.Application.Init ();
+            ThreadAssist.InitializeMainThread ();
+            ThreadAssist.ProxyToMainHandler = RunIdle;
+            Hyena.Log.Notify += OnLogNotify;
+            Gtk.Window.DefaultIconName = "pdfmod";
+        }
+
+        public Client () : this (false)
+        {
+        }
 
-        public PdfMod ()
+        internal Client (bool loadFiles)
         {
             app_count++;
 
-            Window = new Gtk.Window (WindowType.Toplevel);
+            Window = new Gtk.Window (Gtk.WindowType.Toplevel);
             Window.Title = Catalog.GetString ("PDF Mod");
-            Window.DefaultIconName = "pdfmod";
             Window.SetSizeRequest (640, 480);
             Window.DeleteEvent += delegate (object o, DeleteEventArgs args) {
                 Quit ();
@@ -74,7 +58,7 @@ namespace PdfMod
             };
 
             // PDF Icon View
-            IconView = new PdfIconView (this);
+            IconView = new DocumentView (this);
             var iconview_sw = new Gtk.ScrolledWindow ();
             iconview_sw.Child = IconView;
 
@@ -91,7 +75,7 @@ namespace PdfMod
             // ActionManager
             ActionManager = new Hyena.Gui.ActionManager ();
             Window.AddAccelGroup (ActionManager.UIManager.AccelGroup);
-            GlobalActions = new GlobalActions (this, ActionManager);
+            Actions = new Actions (this, ActionManager);
 
             EditorBox = new MetadataEditorBox (this) { NoShowAll = true };
             EditorBox.Hide ();
@@ -117,6 +101,11 @@ namespace PdfMod
             Window.Add (vbox);
 
             Window.ShowAll ();
+
+            if (loadFiles) {
+                RunIdle (LoadFiles);
+                Application.Run ();
+            }
         }
 
         public void ToggleMatchQuery ()
@@ -172,7 +161,7 @@ namespace PdfMod
                 message_dialog.Destroy ();
                 switch (response) {
                     case ResponseType.Ok:
-                        GlobalActions["SaveAs"].Activate ();
+                        Actions["SaveAs"].Activate ();
                         return PromptIfUnsavedChanges ();
                     case ResponseType.Close:
                         return false;
@@ -184,12 +173,8 @@ namespace PdfMod
             return false;
         }
 
-        private void LoadFiles ()
+        protected override void LoadFiles (IList<string> files)
         {
-            // This variable should probably be marked volatile
-            Hyena.Log.Debugging = true;
-
-            var files = ApplicationContext.CommandLine.Files;
             if (files.Count == 1) {
                 LoadPath (files[0]);
             } else if (files.Count > 1) {
@@ -216,19 +201,13 @@ namespace PdfMod
             }
         }
 
-        // TODO support password protected docs
-        public void LoadPath (string path)
-        {
-            LoadPath (path, null);
-        }
-
         private bool loading;
-        public void LoadPath (string path, string suggestedFilename)
+        public override void LoadPath (string path, string suggestedFilename)
         {
             lock (this) {
                 // One document per window
                 if (loading || Document != null) {
-                    new PdfMod ().LoadPath (path, suggestedFilename);
+                    new Client ().LoadPath (path, suggestedFilename);
                     return;
                 }
 
@@ -250,11 +229,7 @@ namespace PdfMod
                         IconView.SetDocument (Document);
                         Document.Changed += UpdateForDocument;
                         UpdateForDocument ();
-
-                        var handler = DocumentLoaded;
-                        if (handler != null) {
-                            handler (this, EventArgs.Empty);
-                        }
+                        OnDocumentLoaded ();
                     });
                 } catch (Exception e) {
                     Document = null;
@@ -368,60 +343,6 @@ namespace PdfMod
             });
         }
 
-        private static void InitCatalog (params string [] dirs)
-        {
-            foreach (var dir in dirs) {
-                var test_file = Path.Combine (dir, "fr/LC_MESSAGES/pdfmod.mo");
-                if (File.Exists (test_file)) {
-                    Log.DebugFormat ("Initializing i18n catalog from {0}", dir);
-                    Catalog.Init ("pdfmod", dir);
-                    break;
-                }
-            }
-        }
-
-        private static void InitCache ()
-        {
-            // Remove the old "cache" dir that really ended up being ~/.config/
-            if (Directory.Exists (old_cache_dir)) {
-                try {
-                    Directory.Delete (old_cache_dir);
-                } catch {}
-            }
-
-            // Make sure the new one exists
-            try {
-                Directory.CreateDirectory (CacheDir);
-                Log.DebugFormat ("Cache directory set to {0}", CacheDir);
-
-                // Remove any tmp files that haven't been touched in three days
-                var too_old = DateTime.Now;
-                too_old.AddDays (-3);
-                foreach (string file in Directory.GetFiles (CacheDir)) {
-                    if (file.Contains ("tmpfile-")) {
-                        if (File.GetLastAccessTime (file) < too_old) {
-                            File.Delete (file);
-                        }
-                    }
-                }
-            } catch (Exception e) {
-                Log.Exception (String.Format ("Unable to create cache directory: {0}", CacheDir), e);
-            }
-        }
-
-        public static string GetTmpFilename ()
-        {
-            string filename = null;
-            int i = 0;
-            while (filename == null) {
-                filename = Path.Combine (CacheDir, "tmpfile-" + i++);
-                if (File.Exists (filename)) {
-                    filename = null;
-                }
-            }
-            return filename;
-        }
-
         public static void RunIdle (InvokeHandler handler)
         {
             GLib.Idle.Add (delegate { handler (); return false; });
diff --git a/src/PdfMod/PdfMod/PdfIconView.cs b/src/PdfMod/Gui/DocumentView.cs
similarity index 97%
rename from src/PdfMod/PdfMod/PdfIconView.cs
rename to src/PdfMod/Gui/DocumentView.cs
index 06df713..58ec601 100644
--- a/src/PdfMod/PdfMod/PdfIconView.cs
+++ b/src/PdfMod/Gui/DocumentView.cs
@@ -3,14 +3,15 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 
-using Gdk;
 using Gtk;
+using Gdk;
 
 using PdfSharp.Pdf;
 
-using PdfMod.Actions;
+using PdfMod.Pdf;
+using PdfMod.Pdf.Actions;
 
-namespace PdfMod
+namespace PdfMod.Gui
 {
     public enum PageSelectionMode
     {
@@ -21,7 +22,7 @@ namespace PdfMod
         All
     }
 
-    public class PdfIconView : Gtk.IconView, IDisposable
+    public class DocumentView : Gtk.IconView, IDisposable
     {
         public const int MIN_WIDTH = 128;
         public const int MAX_WIDTH = 2054;
@@ -38,10 +39,10 @@ namespace PdfMod
         private static readonly TargetEntry move_internal_target = new TargetEntry ("pdfmod/page-list", TargetFlags.Widget, (uint)Target.MoveInternal);
         private static readonly TargetEntry move_external_target = new TargetEntry ("pdfmod/page-list-external", 0, (uint)Target.MoveExternal);
 
-        private PdfMod app;
+        private Client app;
         private Document document;
         private PdfListStore store;
-        private CellRendererPage page_renderer;
+        private PageCell page_renderer;
         private PageSelectionMode page_selection_mode = PageSelectionMode.None;
         private bool highlighted;
 
@@ -64,7 +65,7 @@ namespace PdfMod
 
         public event System.Action ZoomChanged;
 
-        public PdfIconView (PdfMod app) : base ()
+        public DocumentView (Client app) : base ()
         {
             this.app = app;
 
@@ -76,7 +77,7 @@ namespace PdfMod
             Reorderable = false;
             Spacing = 0;
 
-            page_renderer = new CellRendererPage (this);
+            page_renderer = new PageCell (this);
             PackStart (page_renderer, true);
             AddAttribute (page_renderer, "page", PdfListStore.PageColumn);
 
@@ -160,7 +161,7 @@ namespace PdfMod
 
         private void HandlePopupMenu (object o, PopupMenuArgs args)
         {
-            app.GlobalActions["PageContextMenu"].Activate ();
+            app.Actions["PageContextMenu"].Activate ();
         }
 
         #endregion
@@ -290,7 +291,7 @@ namespace PdfMod
                 to_index -= pages.Count (p => p.Index < to_index);
                 var action = new MoveAction (document, pages, to_index);
                 action.Do ();
-                app.GlobalActions.UndoManager.AddUndoAction (action);
+                app.Actions.UndoManager.AddUndoAction (action);
                 args.RetVal = true;
             } else if (target == move_external_target.Target) {
                 int to_index = GetDropIndex (args.X, args.Y);
@@ -420,7 +421,7 @@ namespace PdfMod
 
             if (!zoom_manually_set) {
                 zoom_manually_set = true;
-                (app.GlobalActions["ZoomFit"] as ToggleAction).Active = false;
+                (app.Actions["ZoomFit"] as ToggleAction).Active = false;
             }
 
             int new_width = ItemWidth + pixels;
@@ -450,7 +451,7 @@ namespace PdfMod
             if (document == null)
                 return;
 
-            if ((app.GlobalActions["ZoomFit"] as ToggleAction).Active == false)
+            if ((app.Actions["ZoomFit"] as ToggleAction).Active == false)
                 return;
 
             zoom_manually_set = false;
diff --git a/src/PdfMod/PdfMod/PdfListStore.cs b/src/PdfMod/Gui/ListStore.cs
similarity index 98%
rename from src/PdfMod/PdfMod/PdfListStore.cs
rename to src/PdfMod/Gui/ListStore.cs
index 8800211..5ad6a97 100644
--- a/src/PdfMod/PdfMod/PdfListStore.cs
+++ b/src/PdfMod/Gui/ListStore.cs
@@ -9,7 +9,9 @@ using System.Linq;
 using Mono.Unix;
 using Gtk;
 
-namespace PdfMod
+using PdfMod.Pdf;
+
+namespace PdfMod.Gui
 {
     public class PdfListStore : ListStore
     {
diff --git a/src/PdfMod/PdfMod/MetadataEditorBox.cs b/src/PdfMod/Gui/MetadataEditorBox.cs
similarity index 97%
rename from src/PdfMod/PdfMod/MetadataEditorBox.cs
rename to src/PdfMod/Gui/MetadataEditorBox.cs
index 0197fd7..833e463 100644
--- a/src/PdfMod/PdfMod/MetadataEditorBox.cs
+++ b/src/PdfMod/Gui/MetadataEditorBox.cs
@@ -4,11 +4,13 @@ using System;
 using Mono.Unix;
 using Gtk;
 
-namespace PdfMod
+using PdfMod.Pdf;
+
+namespace PdfMod.Gui
 {
     public class MetadataEditorBox : EventBox
     {
-        private PdfMod app;
+        private Client app;
         private Table table;
         private Button revert_button;
         private Document doc;
@@ -16,7 +18,7 @@ namespace PdfMod
         private TextProperty [] properties;
         private TextProperty title, author, keywords, subject;
 
-        public MetadataEditorBox (PdfMod app)
+        public MetadataEditorBox (Client app)
         {
             this.app = app;
             app.DocumentLoaded += HandleDocumentLoaded;
@@ -151,7 +153,7 @@ namespace PdfMod
 
         public new void Hide ()
         {
-            (app.GlobalActions["Properties"] as Gtk.ToggleAction).Active = false;
+            (app.Actions["Properties"] as Gtk.ToggleAction).Active = false;
             base.Hide ();
             app.IconView.GrabFocus ();
         }
diff --git a/src/PdfMod/PdfMod/CellRendererPage.cs b/src/PdfMod/Gui/PageCell.cs
similarity index 96%
rename from src/PdfMod/PdfMod/CellRendererPage.cs
rename to src/PdfMod/Gui/PageCell.cs
index 9b263e9..c518d0a 100644
--- a/src/PdfMod/PdfMod/CellRendererPage.cs
+++ b/src/PdfMod/Gui/PageCell.cs
@@ -8,16 +8,18 @@ using Cairo;
 using Hyena;
 using Hyena.Collections;
 
-namespace PdfMod
+using PdfMod.Pdf;
+
+namespace PdfMod.Gui
 {
-    public class CellRendererPage : CellRendererCairo, IDisposable
+    public class PageCell : CairoCell, IDisposable
     {
         const int scale_every = 400;
 
         private ThumbnailLruCache surface_cache;
         private IconView parent;
 
-        public CellRendererPage (IconView parent)
+        public PageCell (IconView parent)
         {
             this.parent = parent;
             surface_cache = new ThumbnailLruCache ();
@@ -70,7 +72,7 @@ namespace PdfMod
                 // Create a new thumbnail surface, but only on 200px boundaries, then we scale down if needed
                 var w = width + (width % scale_every);
                 var h = height + (height % scale_every);
-                cache_obj = Page.Document.GetSurface (Page, (int)w, (int)h);
+                cache_obj = Page.Document.GetSurface (Page, (int)w, (int)h, DocumentView.MIN_WIDTH);
                 if (cache_obj == null) {
                     return;
                 }
diff --git a/src/PdfMod/PdfMod/QueryBox.cs b/src/PdfMod/Gui/SelectMatchingBox.cs
similarity index 96%
rename from src/PdfMod/PdfMod/QueryBox.cs
rename to src/PdfMod/Gui/SelectMatchingBox.cs
index bd1abbd..e804757 100644
--- a/src/PdfMod/PdfMod/QueryBox.cs
+++ b/src/PdfMod/Gui/SelectMatchingBox.cs
@@ -4,15 +4,15 @@ using System;
 using Mono.Unix;
 using Gtk;
 
-namespace PdfMod
+namespace PdfMod.Gui
 {
     public class QueryBox : EventBox
     {
-        private PdfMod app;
+        private Client app;
         private HBox hbox;
         public Entry Entry { get; private set; }
 
-        public QueryBox (PdfMod app)
+        public QueryBox (Client app)
         {
             this.app = app;
             AppPaintable = true;
diff --git a/src/PdfMod/Main.cs b/src/PdfMod/Main.cs
new file mode 100644
index 0000000..67a27b2
--- /dev/null
+++ b/src/PdfMod/Main.cs
@@ -0,0 +1,35 @@
+using System;
+using System.IO;
+
+using Mono.Unix;
+using Hyena;
+
+namespace PdfMod
+{
+    public static class PdfMod
+    {
+        public static void Main (string[] args)
+        {
+            ApplicationContext.TrySetProcessName ("pdfmod");
+            Gdk.Global.ProgramClass = "pdfmod";
+            Log.Debugging = true;
+            Log.DebugFormat ("Starting PdfMod");
+
+            InitCatalog ("/usr/local/share/locale/", Core.Defines.PREFIX + "/share/locale/");
+
+            new Gui.Client (true);
+        }
+
+        private static void InitCatalog (params string [] dirs)
+        {
+            foreach (var dir in dirs) {
+                var test_file = Path.Combine (dir, "fr/LC_MESSAGES/pdfmod.mo");
+                if (File.Exists (test_file)) {
+                    Log.DebugFormat ("Initializing i18n catalog from {0}", dir);
+                    Catalog.Init ("pdfmod", dir);
+                    break;
+                }
+            }
+        }
+    }
+}
diff --git a/src/PdfMod/PdfMod.Actions/BasePageAction.cs b/src/PdfMod/Pdf/Actions/BasePageAction.cs
similarity index 97%
rename from src/PdfMod/PdfMod.Actions/BasePageAction.cs
rename to src/PdfMod/Pdf/Actions/BasePageAction.cs
index 04d278c..7e7a6d7 100644
--- a/src/PdfMod/PdfMod.Actions/BasePageAction.cs
+++ b/src/PdfMod/Pdf/Actions/BasePageAction.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
 
 using Hyena;
 
-namespace PdfMod.Actions
+namespace PdfMod.Pdf.Actions
 {
     public interface IDescribedUndoAction : IUndoAction
     {
diff --git a/src/PdfMod/PdfMod.Actions/ExportImagesAction.cs b/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
similarity index 99%
rename from src/PdfMod/PdfMod.Actions/ExportImagesAction.cs
rename to src/PdfMod/Pdf/Actions/ExportImagesAction.cs
index 18f089d..e8289e0 100644
--- a/src/PdfMod/PdfMod.Actions/ExportImagesAction.cs
+++ b/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
@@ -41,7 +41,7 @@ using System.Linq;
 using PdfSharp.Pdf;
 using PdfSharp.Pdf.Advanced;
 
-namespace PdfMod.Actions
+namespace PdfMod.Pdf.Actions
 {
     public class ExportImagesAction
     {
diff --git a/src/PdfMod/PdfMod.Actions/MoveAction.cs b/src/PdfMod/Pdf/Actions/MoveAction.cs
similarity index 93%
rename from src/PdfMod/PdfMod.Actions/MoveAction.cs
rename to src/PdfMod/Pdf/Actions/MoveAction.cs
index f3ebc16..ef2c8c9 100644
--- a/src/PdfMod/PdfMod.Actions/MoveAction.cs
+++ b/src/PdfMod/Pdf/Actions/MoveAction.cs
@@ -10,7 +10,7 @@ using Hyena.Gui;
 
 using PdfMod;
 
-namespace PdfMod.Actions
+namespace PdfMod.Pdf.Actions
 {
     public class MoveAction : BasePageAction
     {
@@ -22,7 +22,7 @@ namespace PdfMod.Actions
             this.to_index = to_index;
             // Translators: {0} is the # of pages, {1} is a translated string summarizing the pages, eg "page 1"
             Description = String.Format (Catalog.GetPluralString ("Move {1}", "Move {1}", Pages.Count),
-                Pages.Count, GlobalActions.GetPageSummary (Pages, 5));
+                Pages.Count, Document.GetPageSummary (Pages, 5));
         }
 
         public override void Undo ()
diff --git a/src/PdfMod/PdfMod.Actions/RemoveAction.cs b/src/PdfMod/Pdf/Actions/RemoveAction.cs
similarity index 98%
rename from src/PdfMod/PdfMod.Actions/RemoveAction.cs
rename to src/PdfMod/Pdf/Actions/RemoveAction.cs
index d1434bd..a36e463 100644
--- a/src/PdfMod/PdfMod.Actions/RemoveAction.cs
+++ b/src/PdfMod/Pdf/Actions/RemoveAction.cs
@@ -9,7 +9,7 @@ using Hyena.Gui;
 
 using PdfMod;
 
-namespace PdfMod.Actions
+namespace PdfMod.Pdf.Actions
 {
     public class RemoveAction : BasePageAction
     {
diff --git a/src/PdfMod/PdfMod.Actions/RotateAction.cs b/src/PdfMod/Pdf/Actions/RotateAction.cs
similarity index 87%
rename from src/PdfMod/PdfMod.Actions/RotateAction.cs
rename to src/PdfMod/Pdf/Actions/RotateAction.cs
index 11ac183..ca940e0 100644
--- a/src/PdfMod/PdfMod.Actions/RotateAction.cs
+++ b/src/PdfMod/Pdf/Actions/RotateAction.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
 
 using Mono.Unix;
 
-namespace PdfMod.Actions
+namespace PdfMod.Pdf.Actions
 {
     public class RotateAction : BasePageAction
     {
@@ -14,7 +14,7 @@ namespace PdfMod.Actions
         {
             this.rotation = rotation;
             Description = String.Format (Catalog.GetPluralString ("Rotate {1}", "Rotate {1}", Pages.Count),
-                Pages.Count, GlobalActions.GetPageSummary (Pages, 5));
+                Pages.Count, Document.GetPageSummary (Pages, 5));
         }
 
         public override void Undo ()
diff --git a/src/PdfMod/PdfMod/Document.cs b/src/PdfMod/Pdf/Document.cs
similarity index 86%
rename from src/PdfMod/PdfMod/Document.cs
rename to src/PdfMod/Pdf/Document.cs
index 0d46740..855204c 100644
--- a/src/PdfMod/PdfMod/Document.cs
+++ b/src/PdfMod/Pdf/Document.cs
@@ -3,12 +3,13 @@ using System;
 using System.Linq;
 using System.Collections.Generic;
 
-using Hyena;
+using Mono.Unix;
 
+using Hyena;
 using PdfSharp.Pdf;
 using PdfSharp.Pdf.IO;
 
-namespace PdfMod
+namespace PdfMod.Pdf
 {
     public class Document : IDisposable
     {
@@ -319,9 +320,9 @@ namespace PdfMod
             }
         }
 
-        public PageThumbnail GetSurface (Page page, int w, int h)
+        public PageThumbnail GetSurface (Page page, int w, int h, int min_width)
         {
-            if (w < PdfIconView.MIN_WIDTH || h < PdfIconView.MIN_WIDTH) {
+            if (w < min_width || h < min_width) {
                 return null;
             }
 
@@ -367,7 +368,7 @@ namespace PdfMod
         {
             try {
                 if (tmp_path == null) {
-                    tmp_path = PdfMod.GetTmpFilename ();
+                    tmp_path = Core.Client.GetTmpFilename ();
                     if (System.IO.File.Exists (tmp_path)) {
                         System.IO.File.Delete (tmp_path);
                     }
@@ -403,5 +404,30 @@ namespace PdfMod
                 handler ();
             }
         }
+
+        // Return a simple, nice string describing the selected pages
+        //   e.g.  Page 1, or Page 3 - 6, or Page 2, 4, 6
+        public static string GetPageSummary (List<Page> pages, int maxListed)
+        {
+            string pages_summary = null;
+            if (pages.Count == 1) {
+                // Translators: {0} is the number of pages (always 1), and {1} is the page number, eg Page 1, or Page 5
+                pages_summary = String.Format (Catalog.GetPluralString ("Page {1}", "Page {1}", pages.Count), pages.Count, pages[0].Index + 1);
+            } else if (pages[0].Index + pages.Count - 1 == pages[pages.Count - 1].Index) {
+                // Translators: {0} is the number of pages, and {1} is the first page, {2} is the last page,
+                // eg Pages 3 - 7
+                pages_summary = String.Format (Catalog.GetPluralString ("Pages {1} - {2}", "Pages {1} - {2}", pages.Count),
+                    pages.Count, pages[0].Index + 1, pages[pages.Count - 1].Index + 1);
+            } else if (pages.Count < maxListed) {
+                string page_nums = String.Join (", ", pages.Select (p => (p.Index + 1).ToString ()).ToArray ());
+                // Translators: {0} is the number of pages, {1} is a comma separated list of page numbers, eg Pages 1, 4, 9
+                pages_summary = String.Format (Catalog.GetPluralString ("Pages {1}", "Pages {1}", pages.Count), pages.Count, page_nums);
+            } else {
+                // Translators: {0} is the number of pages, eg 12 Pages
+                pages_summary = String.Format (Catalog.GetPluralString ("{0} Page", "{0} Pages", pages.Count), pages.Count);
+            }
+            return pages_summary;
+        }
+
     }
 }
diff --git a/src/PdfMod/PdfMod/Page.cs b/src/PdfMod/Pdf/Page.cs
similarity index 94%
rename from src/PdfMod/PdfMod/Page.cs
rename to src/PdfMod/Pdf/Page.cs
index 6995c31..e1cef2a 100644
--- a/src/PdfMod/PdfMod/Page.cs
+++ b/src/PdfMod/Pdf/Page.cs
@@ -3,7 +3,7 @@ using System;
 
 using PdfSharp.Pdf;
 
-namespace PdfMod
+namespace PdfMod.Pdf
 {
     public class Page
     {
diff --git a/src/PdfMod/PdfMod/PageLabels.cs b/src/PdfMod/Pdf/PageLabels.cs
similarity index 99%
rename from src/PdfMod/PdfMod/PageLabels.cs
rename to src/PdfMod/Pdf/PageLabels.cs
index 0dcb5bf..4c30e13 100644
--- a/src/PdfMod/PdfMod/PageLabels.cs
+++ b/src/PdfMod/Pdf/PageLabels.cs
@@ -9,7 +9,7 @@ using PdfSharp;
 using PdfSharp.Pdf;
 using PdfSharp.Pdf.Advanced;
 
-namespace PdfMod
+namespace PdfMod.Pdf
 {
     struct PageLabelFormat
     {
diff --git a/src/PdfMod/PdfMod/PageThumbnail.cs b/src/PdfMod/Pdf/PageThumbnail.cs
similarity index 96%
rename from src/PdfMod/PdfMod/PageThumbnail.cs
rename to src/PdfMod/Pdf/PageThumbnail.cs
index cf9e76d..3d4d521 100644
--- a/src/PdfMod/PdfMod/PageThumbnail.cs
+++ b/src/PdfMod/Pdf/PageThumbnail.cs
@@ -1,7 +1,7 @@
 
 using System;
 
-namespace PdfMod
+namespace PdfMod.Pdf
 {
     public class PageThumbnail : IDisposable
     {
diff --git a/src/PdfMod/Resources/UIManager.xml b/src/Resources/UIManager.xml
similarity index 100%
rename from src/PdfMod/Resources/UIManager.xml
rename to src/Resources/UIManager.xml
diff --git a/src/PdfMod/pdfmod.in b/src/pdfmod.in
similarity index 100%
rename from src/PdfMod/pdfmod.in
rename to src/pdfmod.in



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]