Commit Graph

79 Commits

Author SHA1 Message Date
Martin Nordholts 396d5fd5e8 app: Add a 'restore_func' to GimpDialogFactoryEntry
In gimp_session_info_restore() there is code to create a dialog from a
session info. GimpSessionInfo lives in the widgets module. Thus we
can't add restoration code that depends on a higher level module. In
particular, we can't add code to restore docks in an GimpImageWindow
since GimpImageWindow lives in the display module. And we need such
code to be able to restore a single-window mode session.

Since dialogs are defined in the dialogs module, it makes sense to
also have the code that restores a dialog in that module.

So, add a 'restore_func' member to GimpRestoreDialogFunc of type
GimpRestoreDialogFunc and move the code there.
2011-05-27 21:55:41 +02:00
Martin Nordholts cf4a4bf5a6 app: Make gimp_session_info_dock_restore() take a GimpDockContainer 2011-05-13 21:25:39 +02:00
Martin Nordholts 7edf717bae app: Add image_window boolean to GimpDialogFactoryEntry
Add image_window boolean to GimpDialogFactoryEntry and rename
FOREIGN_NOT_HIDEABLE() to IMAGE_WINDOW(). We need to treat image
windows a bit special when we restore a single-window mode session.
2011-05-13 21:25:39 +02:00
Martin Nordholts 0f19471e22 app: Make GimpDockContainer::get_docks() return a new list
Make GimpDockContainer::get_docks() return a new list and not just a
pointer to a list so that GimpImageWindow can implement it (who needs
to merge its two GimpDockColumns lists).
2011-05-13 21:04:23 +02:00
Michael Natterer 9e60dd547d app: keep a ref to the session info in gimp_session_info_restore()
because failing to restore a dock can destroy the newly created dock
and implicitly unref the session info.
2011-05-12 21:23:06 +02:00
Martin Nordholts 6d421f9d4d app: Add and use gimp_session_info_get_info_with_widget()
Add and use helper function
gimp_session_info_get_info_with_widget(). Might need it for
GimpImageWindow later...
2011-05-09 19:55:51 +02:00
Martin Nordholts 4b9243fc60 app: Make GimpDockWindow implement GimpDockContainer
Make GimpDockWindow implement the GimpDockContainer interface. The
plan is to make GimpImageWindow also implement the GimpDockContainer
interface when we start to session manage docks in single-window mode.
2011-05-09 19:55:51 +02:00
Martin Nordholts f75f61779c app: GimpSessionInfoDock::identifier -> dock_type
Rename GimpSessionInfoDock::identifier to dock_type, because it isn't
really an identifier; there might be several instance with dock_type
being "gimp-dock". This is a preparation for adding an actual
'identifier' member.
2011-04-21 18:59:12 +02:00
Michael Natterer 6c524ea1db app: GimpSessionInfo: use brute force to position dialogs
Window managers are such a crap. So on top of all friendly hinting and
geometry setting, simply use gtk_window_move() whenever a session
managed GtkDialog is shown. It should be very hard to ignore that, but
of course the WM has the last word no matter how hard we try.

Note: this code should be more complex and the signal connection
should happen in GimpDialogFactory. Left it in GimpSessionInfo for now
until it got a bit of testing.
2011-03-26 19:47:44 +01:00
Michael Natterer fcfb7cf160 Use the new g_[s]list_free_full() instead of foreach() and free() 2011-03-07 17:11:28 +01:00
Michael Natterer 37effb99a4 app: use the window's allocation instead of gdk_drawable_get_size() 2010-10-15 15:17:12 +02:00
Michael Natterer ac6ee07184 app: the tests should succeed, so should a normal gimp session
Don't divide by zero in gimp_session_info_class_apply_position_accuracy()
when klass->position_accuracy is 0, which happens on each exit in a normal
session.
2010-06-20 23:26:45 +02:00
Martin Nordholts 49d951d49e app: Introduce error margin in sessionrc in test cases
Introduce a few pixels of error margin in sessionrc, otherwise the
tests are too fragile, widgets have a tendency to change size a bit
and window managers have a tendency to move windows a bit.

Still needs more work, should probably do the same on book positions
too...
2010-06-19 23:55:35 +02:00
Martin Nordholts d7dc2dc1ab app: Make tooltips in the toolbox work again
We need to be able to pass a GimpUIManager to
gimp_dialog_factory_dialog_new(), so make that possible. Also make
sure to set ui_manager in gimp_dialog_factory_dialog_new_internal()
when we create both a dock window and a dock, so tooltips works in
toolboxes created from scratch.
2010-05-16 12:19:18 +02:00
Martin Nordholts fe6699cc1c app: Apply Windows→Hide docks on startup
Change GimpDialogFactory to apply Windows→Hide docks on startup. (We
already do this for docks in single-window mode.)
2010-03-09 08:03:23 +01:00
Martin Nordholts c5c92e484c app: We don't need to show restored dialogs twice 2010-03-09 08:03:23 +01:00
Martin Nordholts 909acba11d app: Introduce GIMP_DIALOG_VISIBILITY_HIDDEN
Introduce GIMP_DIALOG_VISIBILITY_HIDDEN because it is a bit
counter-intuitive to call gtk_widget_hide() on a dialog and then set
GIMP_DIALOG_VISIBILITY_VISIBLE on it. No change in program flow has
been (deliberately) introduced.
2010-03-09 08:03:22 +01:00
Martin Nordholts 11b1300b6f app: Introduce gimp_dialog_factory_get_singleton()
Instead of including dialogs/dialogs.h everywhere, introduce
gimp_dialog_factory_get_singleton(). The dialog factory singleton is
still initialized by dialogs.c though.

Right now the assumption is that we never will have another dialog
factory instance around. There were so many problems before when we
had four of them, so let's just keep one of them around.
2010-02-28 23:23:24 +01:00
Martin Nordholts 947e28596f app: Remove gimp_dialog_factory_from_name()
We only have one dialog factory now, and
gimp_dialog_factory_from_name() doesn't provide compile-time type
safety, so use global_dialog_factory directly instead.
2010-02-28 20:02:45 +01:00
Martin Nordholts dec798e0df app: Serialize factory entry name along with GimpSessionInfo
Serialize factory entry name along with GimpSessionInfo so we can make
the Recently Closed Docks feature work across sessions in a natural
way.
2010-02-20 13:05:16 +01:00
Martin Nordholts 7e94bb3ef2 app: Avoid crash when using Windows -> Recently Closed Docks
This is not a proper fix for anything, it is just avoidance of a
crash.
2010-02-13 17:17:56 +01:00
Martin Nordholts 02d3874eb7 app: Only add "gimp-toolbox" dock to "gimp-toolbox-window" 2010-01-31 20:21:17 +01:00
Martin Nordholts bf92270051 app: Don't crash when the toolbox dock window don't have docks
Session files from GIMP 2.6 don't need to have docks in the toolbox
top-level. Don't crash on that, instead add a "gimp-toolbox" dock
during sessionrc parsing.
2010-01-31 19:04:51 +01:00
Martin Nordholts 1093462ae9 app: Merge 'global_toolbox_factory' into 'global_dock_factory'
Get rid of 'global_toolbox_factory' and manage everything dock-related
with 'global_dock_factory'. The whole of 'global_toolbox_factory' was
a big special-case and getting rid of it makes it easier to extend the
session management with e.g. single-window mode dock functionality.

To get rid of 'global_toolbox_factory' we, roughly, have to
 * Replace 'global_toolbox_factory' with 'global_dock_factory'
   everywhere. We can also get rid of lots of code that did special
   things for the "toolbox" factory.
 * Make the use or interaction with the toolbox explicit in some
   places. For example, a function gimp_dock_window_has_toolbox() has
   been introduced.
 * Make GimpSessionInfoDock have an 'identifier' parameter so we can
   differentiate between the "gimp-dock" and "gimp-toolbox" dock
   types.
2010-01-20 18:29:54 +01:00
Martin Nordholts 56a8cb68a8 app: Have dialog factory entries for the dock windows
Let dock windows have proper GimpDialogFactory entries. This allows us
to get rid of a lot of ugly mostly duplicated code. This also makes us
ready the merge the dock window and toolbox factories which will soon
be done. A few things should be noted:

 * We adjust the wrap box aspect ratio in the toolbox to avoid having
   the toolbox dock window explode

 * We make sure that we still can handle sessionrc files from GIMP 2.6
   and older
2010-01-19 22:24:17 +01:00
Martin Nordholts 34ad9dad1a app: Session manage multi-column dock windows
Introduce GimpSessionInfoDock and session manage multi-column dock
windows. We are still backwards compatible with sessionrc, the only
difference is that a "session-info" entry now can have multiple "dock"
entries.

Also make ond dock window multi-column in the regression test
app/tests/test-session-management.c and adjust positions and image
selection menus a bit.
2009-12-06 14:49:53 +01:00
Martin Nordholts 3bb15eac78 app: Move out dock window logic from gimp_session_info_dock_restore()
Move out dock window logic, most notably aux info, from
gimp_session_info_dock_restore() and put it in
gimp_session_info_restore() where it belongs.
2009-12-05 22:43:32 +01:00
Michael Natterer 1a23b9ecf2 Build with GSEAL_ENABLE and #undef it where accessors are missing 2009-10-17 20:20:39 +02:00
Martin Nordholts c9d8aafb68 app: Change a few GIMP_IS_DOCK to GIMP_IS_DOCK_WINDOW
In many places we are interested in wether or not we have a dock
window, not a dock. This is in preparation for making GimpDock a
non-GimpDockWindow.
2009-09-26 14:26:49 +02:00
Martin Nordholts ae39604a64 app: Add more dialog-factory debug output 2009-09-20 19:30:10 +02:00
Martin Nordholts 94d95e4db2 app: Make GimpSessionInfo members private
Make GimpSessionInfo members private but put them in a shared header
file so gimpsessioninfo-dock.c can access them too.
2009-09-20 17:06:36 +02:00
Martin Nordholts 8bfcd14f9a app: Add GimpSessionInfo getters and setters 2009-09-20 14:51:03 +02:00
Martin Nordholts 7cac9dff67 app: gimp_session_info_set/get_geometry -> apply/read_geometry()
Rename gimp_session_info_set_geometry() to
gimp_session_info_apply_geometry() and gimp_session_info_get_geometry
to gimp_session_info_read_geometry(). The old functions were not
getters and setters and thus the names were misleading.
2009-09-20 13:17:27 +02:00
Martin Nordholts 4ab58d2e77 app: Have only one GimpDialogFactoryEntry member in GimpSessionInfo
Simplify the code a bit by replacing the 'toplevel_entry' and
'dockable_entry' members in GimpSessionInfo with a single
'factory_entry'. We compensate for this by adding a 'dockable'
gboolean to GimpDialogFactoryEntry.
2009-09-20 12:24:41 +02:00
Martin Nordholts 44d5728d7b app: Add and use factory entry related getters for GimpSessionInfo
Add GimpSessionInfo getters for a bunch of dialog factory entry
fields. This moves much of the GimpDock special casing to a common
place and also reduces direct access to session info fields.
2009-09-20 11:43:41 +02:00
Michael Natterer d85fb156b5 app/widgets/gimpblobeditor.c app/widgets/gimpbrushselect.c
2009-03-22  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpblobeditor.c
	* app/widgets/gimpbrushselect.c
	* app/widgets/gimpcolorbar.c
	* app/widgets/gimpcolordialog.c
	* app/widgets/gimpcolorframe.c
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimpcontrollereditor.c
	* app/widgets/gimpcontrollerlist.c
	* app/widgets/gimpcursor.c
	* app/widgets/gimpcurveview.c
	* app/widgets/gimpdasheditor.c
	* app/widgets/gimpdialogfactory.c
	* app/widgets/gimpdnd-xds.c
	* app/widgets/gimpdockable.c
	* app/widgets/gimperrordialog.c
	* app/widgets/gimpfgbgeditor.c
	* app/widgets/gimpfgbgview.c
	* app/widgets/gimpfiledialog.c
	* app/widgets/gimpfontselect.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimpgradientselect.c
	* app/widgets/gimphandlebar.c
	* app/widgets/gimphistogrambox.c
	* app/widgets/gimphistogramview.c
	* app/widgets/gimpmessagedialog.c
	* app/widgets/gimpnavigationview.c
	* app/widgets/gimppaletteselect.c
	* app/widgets/gimppaletteview.c
	* app/widgets/gimppatternselect.c
	* app/widgets/gimpprogressbox.c
	* app/widgets/gimpprogressdialog.c
	* app/widgets/gimpscalebutton.c
	* app/widgets/gimpselectiondata.c
	* app/widgets/gimpsessioninfo.c
	* app/widgets/gimpsettingsbox.c
	* app/widgets/gimpstrokeeditor.c
	* app/widgets/gimptexteditor.c
	* app/widgets/gimptoolbox.c
	* app/widgets/gimpuimanager.c
	* app/widgets/gimpview-popup.c
	* app/widgets/gimpview.c
	* app/widgets/gimpviewabledialog.c
	* app/widgets/gimpwidgets-utils.c: use accessors for various
	members of GTK+ structures that don't exist any longer when
	GSEAL_ENABLE is defined.


svn path=/trunk/; revision=28193
2009-03-22 16:35:53 +00:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Sven Neumann 7c389ba534 don't report negative offsets, they would be interpreted wrongly.
2008-07-23  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpsessioninfo.c 
(gimp_session_info_get_geometry):
	don't report negative offsets, they would be interpreted 
wrongly.


svn path=/trunk/; revision=26292
2008-07-23 11:45:39 +00:00
Michael Natterer ff5310a4ea Implement the presistent menu of recently closed docks, still somewhat
2008-05-16  Michael Natterer  <mitch@gimp.org>

	Implement the presistent menu of recently closed docks, still
	somewhat hackish but fully functional. Fixes bug #132744.

	* app/actions/dialogs-actions.c
	* app/actions/dialogs-commands.[ch]
	* menus/image-menu.xml.in: remove the menu items that were
	creating the hardcoded preconfigured docks.

	* app/dialogs/dialogs.[ch]: add GimpContainer of recently closed
	docks and API to load and save it.

	* app/gui/session.c: call the recent dock load and save functions.

	* app/widgets/gimpsessioninfo.[ch]: implement the GimpConfig interface
	and (de)serialize via proper interface methods.

	* app/gui/session.c
	* app/widgets/gimpdialogfactory.c: use the GimpConfig API
	to (de)serialize session infos and added the code that was
	formerly in the info's (de)serialize functions but didn't belong
	there.

	* app/widgets/gimpaction.[ch]: add "max-width-chars" property and
	set it on proxy menu item labels.

	* app/actions/windows-actions.[ch]
	* app/actions/windows-commands.[ch]
	* app/menus/windows-menu.c: add actions and menu of recently
	closed docks and code to restore the dock when the menu items are
	selected. Use above new action property to ensure a minimum
	width of the menu.

	* app/widgets/gimpmenudock.c: use '-' instead of '|' for
	separating notebooks in the window title. Menu items don't like	'|'.

	* app/widgets/gimpdock.c: removed the confirmation dialog when
	closing docks and simply add them to the recent docks container.
	This code is totally misplaced and will move to another file soon.


svn path=/trunk/; revision=25671
2008-05-16 16:06:42 +00:00
Michael Natterer 5766498fff Made session info serialization independent from widgets so it can be used
2008-05-14  Michael Natterer  <mitch@gimp.org>

	Made session info serialization independent from widgets so it can
	be used on stored dock layouts which are not open:

	* app/widgets/gimpsessioninfo-book.[ch]
	* app/widgets/gimpsessioninfo-dock.[ch]
	* app/widgets/gimpsessioninfo-dockable.[ch]: add from_widget()
	functions which return newly allocated session info structs.
	Changed serialize() functions to take these structs instead of
	widgets. Changed deserialize() functions to return the structs
	instead of appending them to lists in their parent structs. Don't
	free anything in restore().

	* app/widgets/gimpsessioninfo-aux.[ch]
	(gimp_session_info_aux_serialize): take a GList of aux_info
	instead of a widget.

	* app/widgets/gimpsessioninfo.[ch]: add new functions get_info()
	which collects above session info details from dialogs and
	clear_info() which clears that info. Call clear_info() from
	finalize(). Don't free anything in restore().

	* app/widgets/gimpdialogfactory.c
	(gimp_dialog_factories_save_foreach): collect the session info
	detials from the dialogs before serializing because serialize()
	doesn't know about the widget any longer. Clear the infos after
	serializing.

	(gimp_dialog_factories_restore_foreach): clear the session info
	details after creating the dialogs because restore() doesn't clear
	the info by itself any longer.


svn path=/trunk/; revision=25657
2008-05-13 23:43:57 +00:00
Michael Natterer 24a7aa75bd turn "info != NULL" checks into "GIMP_IS_SESSION_INFO (info)".
2008-05-13  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo.c: turn "info != NULL" checks into
	"GIMP_IS_SESSION_INFO (info)".


svn path=/trunk/; revision=25656
2008-05-13 21:29:00 +00:00
Michael Natterer 0b0d0aad78 turn into a GimpObject subclass. No logical changes yet.
2008-05-13  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo.[ch]: turn into a GimpObject
	subclass. No logical changes yet.

	* app/widgets/widgets-types.h
	* app/widgets/gimpdialogfactory.c: changed accordingly.


svn path=/trunk/; revision=25655
2008-05-13 21:17:11 +00:00
Michael Natterer f720839757 use gdk_drawable_get_size() instead of looking at widget->allocation since
2008-03-23  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo.c (gimp_session_info_get_geometry):
	use gdk_drawable_get_size() instead of looking at
	widget->allocation since the latter is not yet updated if this
	function is called from the dialog factory's "configure-event"
	callback. Fixes remembering of dialog sizes within one session.


svn path=/trunk/; revision=25175
2008-03-23 13:30:03 +00:00
Sven Neumann f8d1aba0e4 removed leftover debug output
svn path=/trunk/; revision=25170
2008-03-22 01:22:31 +00:00
Sven Neumann 39377e970e themes/Default/gtkrc reduced minimum dock width to 200 pixels.
2008-03-22  Sven Neumann  <sven@gimp.org>

	* themes/Default/gtkrc
	* app/widgets/gimpmenudock.c: reduced minimum dock width to 200
	pixels.

	* etc/sessionrc: use -0 instead of -1, just like in X geometry
	strings. Changed default dock sizes to be taller but less wide.

	* app/widgets/gimpsessioninfo.c: changed code to parse -0 from 
the
	sessionrc file and to deal more correctly with negative offsets.


svn path=/trunk/; revision=25169
2008-03-22 01:10:51 +00:00
Sven Neumann 17b27bc768 simplified the logic of gimp_session_info_set_geometry()
svn path=/trunk/; revision=25168
2008-03-21 23:54:46 +00:00
Sven Neumann 985015ca06 deal with negative positions read from the sessionrc file and interpret
2008-03-22  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpsessioninfo.c 
(gimp_session_info_set_geometry):
	deal with negative positions read from the sessionrc file and
	interpret them as a hint to align the window with the right,
	respective bottom edge of the screen.

	* etc/sessionrc: position the toolbox in the upper left, the
	additional dock in the upper right corner of the screen.


svn path=/trunk/; revision=25167
2008-03-21 23:43:21 +00:00
Michael Natterer 1a5cfac5e6 app/widgets/gimpsessioninfoaux.[ch] app/widgets/gimpsessioninfobook.[ch]
2007-05-25  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfoaux.[ch]
	* app/widgets/gimpsessioninfobook.[ch]
	* app/widgets/gimpsessioninfodock.[ch]
	* app/widgets/gimpsessioninfodockable.[ch]: renamed these...

	* app/widgets/gimpsessioninfo-aux.[ch]
	* app/widgets/gimpsessioninfo-book.[ch]
	* app/widgets/gimpsessioninfo-dock.[ch]
	* app/widgets/gimpsessioninfo-dockable.[ch]: ...to these.

	* app/widgets/Makefile.am
	* app/widgets/gimpcoloreditor.c
	* app/widgets/gimpcursorview.c
	* app/widgets/gimpdataeditor.c
	* app/widgets/gimpdocked.c
	* app/widgets/gimphistogrameditor.c
	* app/widgets/gimpmenudock.c
	* app/widgets/gimppaletteeditor.c
	* app/widgets/gimpsessioninfo.c: changed accordingly.


svn path=/trunk/; revision=22614
2007-05-25 11:42:28 +00:00
Michael Natterer 736b651d24 app/widgets/gimpsessioninfo.[ch] app/widgets/gimpsessioninfoaux.[ch]
2007-05-24  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo.[ch]
	* app/widgets/gimpsessioninfoaux.[ch]
	* app/widgets/gimpsessioninfobook.[ch]
	* app/widgets/gimpsessioninfodock.c
	* app/widgets/gimpsessioninfodockable.[ch]: cleanup.


svn path=/trunk/; revision=22606
2007-05-24 20:42:56 +00:00
Michael Natterer 2bf21338a3 removed more code and cleaned up the API.
2007-05-24  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo.[ch]: removed more code and cleaned
	up the API.

	* app/widgets/Makefile.am
	* app/widgets/gimpsessioninfodock.[ch]: added the removed code here.

	* app/widgets/gimpdialogfactory.c: changed accordingly.


svn path=/trunk/; revision=22604
2007-05-24 20:06:34 +00:00