Commit Graph

173 Commits

Author SHA1 Message Date
Přemysl Eric Janouch b08217f999 Add a "selection-changed" signal to LdDiagram.
Make existing code emit this signal.
2011-01-05 04:37:42 +01:00
Přemysl Eric Janouch e92bebfa57 Add ld_diagram_{select,unselect}_all(). 2011-01-05 04:35:25 +01:00
Přemysl Eric Janouch c4b8f092b7 Export cairo_{get,set}_line_width to Lua symbols. 2011-01-05 03:56:59 +01:00
Přemysl Eric Janouch 25f1186000 Draw selected objects with another color.
Store all colors in LdCanvasPrivate and initialize them upon
object creation. This creates a base for color themes.

Make attempts to try adding an object that's not a part
of the document to the selection issue a warning.
2011-01-05 01:11:03 +01:00
Přemysl Eric Janouch fdf1ddbbb1 Move lines around. No functional change. 2011-01-04 23:05:38 +01:00
Přemysl Eric Janouch d3e5483c84 Make adding symbols to the diagram possible.
This required creating a simple framework for operations to LdCanvas.
It is probable that it's going to require some changes when other
operations are added. The basic idea behind it seems to be good, though.
2011-01-04 09:54:05 +01:00
Přemysl Eric Janouch 713f2821e4 Fix the desktop file.
The "Exec" and "Name" entries were swapped.
2011-01-04 06:06:26 +01:00
Přemysl Eric Janouch 25a0ea7ce5 Fix the "library" property in LdCanvas. 2011-01-04 04:08:05 +01:00
Přemysl Eric Janouch 820239597e Partial refactoring of LdCanvas.
draw_symbol() had been doing too much.
2011-01-04 00:45:44 +01:00
Přemysl Eric Janouch 2cb570f894 Split in-out parameters into separate in and out.
In functions:
ld_canvas_diagram_to_widget_coords()
ld_canvas_widget_to_diagram_coords()
2011-01-03 05:57:22 +01:00
Přemysl Eric Janouch 9d505f0a87 Update the copy of FindGTK2.cmake. 2010-12-24 05:41:52 +01:00
Přemysl Eric Janouch 9dc1822040 Fix problems discovered while testing on Windows.
* Set the working directory for glib-genmarshal correctly.
* Use one more path suffix when searching for glibconfig.h.
* Don't assume that gdk_screen_get_resolution() returns
  a useful value.
2010-12-20 05:20:21 +01:00
Přemysl Eric Janouch b44b3e6a54 Documentation maintenance.
* Do not require gtk-doc to be installed.
* Use FindPackageHandleStandardArgs in FindGtkDoc.cmake.
* Fix installation (wrong source path).
* Don't install neither the documentation nor the desktop file on Windows.
2010-12-18 17:47:37 +01:00
Přemysl Eric Janouch 9178fb8d81 LdCanvas maintenance.
* Rename ld_canvas_translate_*_coordinates() to ld_canvas_*_to_*_coords().
* Add missing parameter assertions to those functions.
* Rename local variables in draw_grid().
* Use gdk_cairo_rectangle() in expose-event handler.
* Update comments.
2010-12-18 15:34:34 +01:00
Přemysl Eric Janouch f2f308f2f5 Make the symbol menu grab focus.
This way when the user clicks outside the menu when it is open,
the menu will close itself first.

Keyboard input is however still not handled.

The symbol menu should be redesigned.
2010-12-18 05:01:50 +01:00
Přemysl Eric Janouch 86e73f86c2 Rename LdDocument* to LdDiagram*.
My bad; this name is much more appropriate.
2010-12-16 11:34:02 +01:00
Přemysl Eric Janouch 721cc30478 Overall cleanup.
* Add missing asserts to exported functions.
* Unify formatting.
* Fix the gtk-doc comment for ld_symbol_category_set_human_name().
* Make ld_library_load() reflect it's declaration.
* Remove an unused variable in ld_library_load_cb().
* Change all char's to gchar's.
2010-12-16 06:51:18 +01:00
Přemysl Eric Janouch 4a946b3241 Implement diagram operations in UI.
* Now diagrams can be created, loaded and saved.
* Define descriptions and accelerators for actions.
* Set irrelevant actions unsensitive.
* Also remove redundant comments for clarity.
2010-12-16 06:10:28 +01:00
Přemysl Eric Janouch 2c3345a4fd Add change notifications to properties.
Also fix the "human-name" property in LdSymbolCategory
and correct gtk-doc comments for coordinates properties
accessors in LdDocumentObject.
2010-12-16 04:50:54 +01:00
Přemysl Eric Janouch 45aeda982b Remove redundant flags from signals. 2010-12-12 18:17:13 +01:00
Přemysl Eric Janouch a56bfd6087 LdWindowMain cleanup.
* Restructure the initialization code.
* Move LdCanvas event mask setting to ld-canvas.c.
* Remove some redundant code.
* Use consistent naming.
* Update comments.

Practically no functional change.
2010-12-12 17:56:59 +01:00
Přemysl Eric Janouch fdab244e2e Rename local LdCanvas methods.
Use a "real" prefix, as GTK+ does.
2010-12-12 17:30:28 +01:00
Přemysl Eric Janouch f9dbe12971 Stubplement LdDocument file operations.
Prototypes for these functions were wrong; fixed.
2010-12-11 20:32:03 +01:00
Přemysl Eric Janouch e364267010 Add a "modified" property to LdDocument.
The property is set to TRUE whenever the document changes.
The user may set it back to FALSE with ld_document_set_modified().

Also don't emit the "changed" signal when nothing has happened.
2010-12-11 20:31:54 +01:00
Přemysl Eric Janouch 805089c38f Rename local LdLuaSymbol methods.
Use a "real" prefix, as GTK+ does.

Also make the implementations of virtual functions
really static, as they prototypes were telling.
2010-12-11 14:26:00 +01:00
Přemysl Eric Janouch afacad693d Add a main toolbar.
So far it has no special powers. This should change in the future.
2010-12-11 04:15:23 +01:00
Přemysl Eric Janouch fe7c270bdd Check for name collisions in symbol categories. 2010-12-11 03:49:54 +01:00
Přemysl Eric Janouch e6230576b7 Add category.json files for testing categories. 2010-12-11 03:49:53 +01:00
Přemysl Eric Janouch 67325d5f70 Read human names of categories from category.json.
category.json contains a JSON object/table with localized
names of the category directory they are located within.

If a localized name cannot be found, the name of the category
is used as the human name, too.
2010-12-11 03:49:46 +01:00
Přemysl Eric Janouch 74e43ceee4 Add a "human-name" property to LdSymbolCategory.
Just as LdSymbol has a human name for localization purposes,
LdSymbolCategory also needs to have this property.

Use the human name in tooltips.
2010-12-11 02:44:00 +01:00
Přemysl Eric Janouch aeb6e7ed58 Add a few symbols for testing.
The lucky ones are: capacitor, resistor and diode.

More symbols can be expected later, when more cairo
functions are exported to Lua and relevant standards
become accessible to me.
2010-12-10 23:27:45 +01:00
Přemysl Eric Janouch dea23f1204 Draw symbols from LdDocument in LdCanvas.
Just the minimal implementation so far.
2010-12-10 22:58:36 +01:00
Přemysl Eric Janouch 3419680f25 Implement more of LdCanvas.
1. Add methods for coordinate translation between cairo/GtkWidget
   coordinates and LdDocument coordinates.
2. Draw the grid correctly (also make it significantly faster).
3. Place the canvas into a GtkScrolledWindow and register
   the set_scroll_adjustments signal in the GtkWidget base class.
4. Allow scrolling inside of an area of 200 x 200 units (for now).
   In the future, it should be possible to go to infinity.
2010-12-10 22:36:41 +01:00
Přemysl Eric Janouch 37d898fb1a Change LdSymbolArea members.
Now it contains coordinates of the top-left delimiting
point and computed dimensions (instead of coorinates of
both delimiting points).
2010-12-10 08:57:42 +01:00
Přemysl Eric Janouch 3d3a71d5d2 Prepare the project for json-glib.
This required writing a special CMake find module.
2010-12-05 15:30:21 +01:00
Přemysl Eric Janouch 1d956964e2 Random fixes.
Mostly found by -Wextra.
2010-12-05 15:21:00 +01:00
Přemysl Eric Janouch 147cf2977a Initial LdDocument implementation.
The document maintains a list of LdDocumentObject objects.
2010-12-05 15:15:52 +01:00
Přemysl Eric Janouch 7a0b280854 Add a "library" property to LdCanvas.
Also make the code reference properties properly.
2010-11-19 07:05:44 +01:00
Přemysl Eric Janouch d31d420f59 Symbols are required to save cairo state. 2010-11-16 10:30:10 +01:00
Přemysl Eric Janouch 8f2dad4ead Added basic onscreen symbol menu.
So far it does not add symbols to the document,
as there is momentarily no interface for neither
the document nor the canvas.
2010-11-16 10:26:15 +01:00
Přemysl Eric Janouch 263aa9062e Formatting and naming changes in LdWindowMain. 2010-10-28 14:11:59 +02:00
Přemysl Eric Janouch 5a24eaabb2 Made Lua symbol registration more robust. 2010-10-28 09:07:47 +02:00
Přemysl Eric Janouch 9271ce1134 Separate LdLua and LdSymbolCategory.
Originally, ld_lua_load_file_to_category() was adding
registered symbols into a passed LdSymbolCategory object.
This interface has been rewritten to be more generic
by using callbacks to notify about new symbols.
2010-10-27 20:49:21 +02:00
Přemysl Eric Janouch 8b5fa9a49a Implement parts of Lua symbol registration.
The human name and area now gets resolved.
2010-10-27 20:05:52 +02:00
Přemysl Eric Janouch 1c5127068e Fix gtk-doc comments. 2010-10-27 18:18:37 +02:00
Přemysl Eric Janouch 121d923d29 Added an "area" property to LdSymbol.
To accomplish this, LdSymbolArea had to be converted
to a regular boxed type.
2010-10-27 18:15:31 +02:00
Přemysl Eric Janouch 9156953cc9 Add more properties to LdSymbol.
Also move the actual storage of symbol properties to implementations
of the abstract LdSymbol class. All the properties are read only.
2010-10-27 16:52:00 +02:00
Přemysl Eric Janouch aa33db342b Added ld_library_find_symbol().
This function tries to return a symbol that corresponds
to the given identifier.
2010-10-26 20:01:52 +02:00
Přemysl Eric Janouch 979308aa7f Manage LdLibrary children in a GSList.
The previous method of containment, that is using GHashTable,
did not list children in any particular order.

Also names of children were duplicated. One copy has been
stored as a hash table index and another was present in the
child itself.
2010-10-26 16:41:03 +02:00
Přemysl Eric Janouch 9a242786b1 Redesign and implement the basic parts of LdLua.
There's a very strong bond between LdLua and LdLuaSymbol.
LdLuaSymbol is more like an interface to LdLua than a separate object.
2010-10-26 16:40:53 +02:00