Skip to content

Commit

Permalink
Add combobox type for area (+ bump version + tooltips)
Browse files Browse the repository at this point in the history
  • Loading branch information
cchantep committed Aug 14, 2014
1 parent d2f59db commit 92eb164
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
26 changes: 22 additions & 4 deletions Dhek/GUI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ makeGUI = do
fitem <- Gtk.menuItemNewWithLabel $ msgStr MsgFile
oitem <- Gtk.menuItemNewWithLabel $ msgStr MsgOpenPDF
ovitem <- Gtk.menuItemNewWithLabel $ msgStr MsgOpenBlank
Gtk.set ovitem [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgOpenBlankTooltip]
iitem <- Gtk.menuItemNewWithLabel $ msgStr MsgLoadMappings
sitem <- Gtk.menuItemNewWithLabel $ msgStr MsgSaveMappings
citem <- Gtk.checkMenuItemNewWithLabel $ msgStr MsgEnableOverlap
Expand All @@ -166,18 +168,26 @@ makeGUI = do
-- Button Next
nimg <- loadImage Resources.goNext
next <- Gtk.toolButtonNew (Just nimg) Nothing
Gtk.set next [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgNextPageTooltip]

-- Previous Prev
pimg <- loadImage Resources.goPrevious
prev <- Gtk.toolButtonNew (Just pimg) Nothing
Gtk.set prev [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgPreviousPageTooltip]

-- Button Zoom out
oimg <- loadImage Resources.zoomOut
minus <- Gtk.toolButtonNew (Just oimg) Nothing
Gtk.set minus [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgZoomOutTooltip]

-- Button Zoom in
iimg <- loadImage Resources.zoomIn
plus <- Gtk.toolButtonNew (Just iimg) Nothing
Gtk.set plus [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgZoomInTooltip]

-- Button Draw
drwb <- Gtk.toggleToolButtonNew
Expand All @@ -195,6 +205,8 @@ makeGUI = do
-- Button MultiSelection
msb <- Gtk.toggleToolButtonNew
simg <- loadImage Resources.rectangularSelection
Gtk.set msb [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgSelectionModeTooltip]
Gtk.toolButtonSetIconWidget msb $ Just simg

-- Main Toolbar
Expand All @@ -217,7 +229,8 @@ makeGUI = do
-- Button Applidok
kimg <- loadImage Resources.applidok
akb <- Gtk.toolButtonNew (Just kimg) Nothing

Gtk.set akb [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgApplidokTooltip]

-- Mode toolbar
mtoolbar <- Gtk.toolbarNew
Expand Down Expand Up @@ -317,14 +330,19 @@ makeGUI = do
Gtk.boxPackStart hbox vbox Gtk.PackGrow 0
Gtk.boxPackStart hbox vleft Gtk.PackNatural 0

-- Properties
-- Remove button
rem <- Gtk.buttonNewWithLabel $ msgStr MsgRemove
rmimg <- loadImage Resources.drawEraser
Gtk.buttonSetImage rem rmimg
Gtk.set rem [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgRemoveTooltip]

-- Apply button
app <- Gtk.buttonNewWithLabel $ msgStr MsgApply
apimg <- loadImage Resources.dialogAccept
Gtk.buttonSetImage app apimg
Gtk.set app [Gtk.widgetTooltipText Gtk.:=
Just $ msgStr MsgApplyTooltip]

idxspin <- Gtk.spinButtonNewWithRange 0 200 1
nlabel <- Gtk.labelNew (Just $ msgStr MsgName)
Expand Down Expand Up @@ -363,7 +381,7 @@ makeGUI = do
Gtk.tableAttachDefaults table idxspin 1 2 3 4
Gtk.tableSetRowSpacings table 10
Gtk.tableSetColSpacings table 10
let types = ["text", "checkbox", "radio", "textcell"]
let types = ["text", "checkbox", "radio", "comboitem", "textcell"]
traverse_ (Gtk.listStoreAppend tstore) types
Gtk.containerAdd salign hsep
Gtk.widgetSetSensitive rem False
Expand Down Expand Up @@ -520,7 +538,7 @@ guiClearPdfCache gui
--------------------------------------------------------------------------------
layoutMapping :: Rect -> [Gtk.AttrOp Gtk.CellRendererText]
layoutMapping r
| r ^. rectType == "radio" =
| r ^. rectType == "radio" || r ^. rectType == "comboitem" =
let value = fromMaybe "" (r ^. rectValue)
name = r ^. rectName
label = name ++ " (" ++ value ++ ")" in
Expand Down
2 changes: 1 addition & 1 deletion Dhek/Signal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ connectSignals g i = do
_ <- Gtk.on (guiTypeCombo g) Gtk.changed $ do
opt <- Gtk.comboBoxGetActiveText $ guiTypeCombo g
for_ opt $ \c -> do
gtkSetValuePropVisible (c == "radio") g
gtkSetValuePropVisible (c == "radio" || c == "comboitem") g
gtkSetIndexPropVisible (c == "textcell") g

Gtk.on (guiVRuler g) Gtk.buttonPressEvent $ Gtk.tryEvent $ liftIO $
Expand Down
2 changes: 1 addition & 1 deletion dhek.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dhek
version: 1.0.11
version: 1.0.12
-- synopsis:
-- description:
-- license:
Expand Down
11 changes: 10 additions & 1 deletion messages/en.msg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EnableOverlap: Enable overlapping areas
Previous: Previous
Next: Next
Remove: Remove
RemoveTooltip: Remove selected areas
Name: Name
Type: Type
Areas: Areas
Expand All @@ -18,6 +19,7 @@ Choose: Choose
ChooseJSON: Choose a JSON file
MainTitle: Dhek - PDF templating
Apply: Apply
ApplyTooltip: Apply area changes
Value: Value
Yes: Yes
No: No
Expand All @@ -34,6 +36,13 @@ DupHelp: Drag&drop area to duplicate it
SelectionHelp meta@String: Click to start selection, release to finalize. #{meta} + click to update selection.
JsonFormatError msg@String: Invalid mapping file: #{msg}
NormalModeTooltip: Draw areas over document
SelectionModeTooltip: Select several areas, apply bulk operations.
OpenBlank: Open blank document
OpenBlankTooltip: Open an in-memory blank document to create a template from scratch
BlankDocument: *Blank Document*
NoArea: No area was defined. Template file cannot be saved.
NoArea: No area was defined. Template file cannot be saved.
ZoomInTooltip: Zoom In
ZoomOutTooltip: Zoom Out
ApplidokTooltip: Open Applidok service
PreviousPageTooltip: Go back to previous page
NextPageTooltip: Go to next page
9 changes: 9 additions & 0 deletions messages/fr.msg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EnableOverlap: Autoriser le chevauchement des zones
Previous: Précédent
Next: Suivant
Remove: Supprimer
RemoveTooltip: Supprimer les zones sélectionnées
Name: Nom
Type: Type
Areas: Zones
Expand All @@ -18,6 +19,7 @@ Choose: Choisir
ChooseJSON: Choisir un fichier JSON
MainTitle: Dhek - Création de modèle PDF
Apply: Appliquer
ApplyTooltip: Appliquer les changements sur la zone
Value: Valeur
Yes: Oui
No: Non
Expand All @@ -34,6 +36,13 @@ DupHelp: Glisser-déposer une zone pour la dupliquer
SelectionHelp meta@String: Cliquer pour débuter une sélection, relâcher pour terminer. #{meta} + clic pour modifier la sélection.
JsonFormatError msg@String: Format du fichier modèle incorrect: #{msg}
NormalModeTooltip: Dessiner les zones sur le document
SelectionModeTooltip: Sélectionner plusieurs zones, modifications groupées.
OpenBlank: Ouvrir un document vierge
OpenBlankTooltip: Ouvrir un document vierge, pour créer un modèle de zéro.
BlankDocument: *Document vierge*
NoArea: Aucune zone n'a été ajoutée. Le fichier modèle ne peut être sauvegardé.
ZoomInTooltip: Augmenter l'échelle du document
ZoomOutTooltip: Diminuer l'échelle du document
ApplidokTooltip: Ouvrir le service Applidok
PreviousPageTooltip: Aller à la page précédente
NextPageTooltip: Aller à la page suivante

1 comment on commit 92eb164

@cchantep
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit should not be duplicated in this branch, as already in master. Seems rebase has gone wrong there.

Please sign in to comment.