61 Commits

Author SHA1 Message Date
ef2966e9bc Bump to version 0.1.2.
Update NEWS.
2011-03-07 17:29:27 +01:00
7069108a0a Fix action labels in Czech and Slovak. 2011-03-07 17:29:27 +01:00
d4cff849f8 Change language team e-mail addresses. 2011-03-07 17:29:27 +01:00
3430bf30bb Add German translation. 2011-03-07 17:29:27 +01:00
0640067bf0 Add Polish translation. 2011-03-07 17:29:27 +01:00
1c118251bd Update translations. 2011-03-07 17:29:27 +01:00
94cb6ee53a Add toggle actions to the View menu.
So far these settings are not saved anywhere.
2011-03-07 17:29:27 +01:00
c8caca073f Add API for turning off the grid. 2011-03-07 17:29:26 +01:00
6ae08ee425 Glue to terminal points when creating connections. 2011-03-07 17:29:26 +01:00
89b20380d3 Allow rotating of symbols while placing them. 2011-03-07 17:29:26 +01:00
e40591feb8 Add the ohmmeter back again.
This time, it's a regular curve.
2011-03-07 17:29:26 +01:00
01dea6fb2e Add separate plus and minus signs. 2011-03-07 17:29:26 +01:00
f821e029d7 Add a user guide for Microsoft Windows.
Currently in two translations, Czech and English.

Only the XeLaTeX sources are provided.

This is to be later replaced by a multiplatform, multilingual
DocBook-based documentation, but that requires a bit more work
on integrating it with CMake and all.
2011-03-07 17:29:26 +01:00
df5f14060b Add Slovak translation. 2011-03-07 17:29:19 +01:00
582b24562c Update translations.
Add translators to the About dialog.
2011-03-04 17:42:32 +01:00
bd1b3adf56 Update symbol library.
* Workaround the Windows pangocairo bug by drawing text
  with curves. Remove some of the meters.
* Remove terminal lines from meters and voltage sources,
  add vertical terminal points instead.
2011-02-24 08:14:48 +01:00
8cdefbca29 Bump version to 0.1.1. 2011-02-20 14:46:47 +01:00
0aaa214a75 Update NEWS. 2011-02-20 14:46:47 +01:00
b37f856557 Update links in Win32Depends.cmake. 2011-02-20 14:46:47 +01:00
7d2b3a8c2f Install the NEWS file. 2011-02-20 14:46:46 +01:00
95b92e12f9 Fix gtk-doc comments. 2011-02-20 13:39:44 +01:00
403a9d702a Disable LdDiagramView scrollbars when not needed. 2011-02-20 12:54:15 +01:00
f9827e2ff3 Refactor oper_connect_motion(). 2011-02-20 12:41:45 +01:00
d4bfd8a504 Convert encoding of command line filenames.
Fixes Windows.
2011-02-19 23:27:00 +01:00
8f8866ffc4 Fix transistor symbols. 2011-02-19 22:49:21 +01:00
f074bc6742 Also find terminals on ends of connections. 2011-02-19 22:49:21 +01:00
8aef3fc772 Use "typedef struct" in ld-diagram-view.c. 2011-02-19 22:49:20 +01:00
b5ff3b5bbb Don't emit changes when reading.
When the value for a property isn't present in it's JsonObject,
it can be assigned upon reading. Previously this could generate
history events even when just viewing an old diagram with some
of newer properties missing.

Modify the code, so setting to default doesn't count as a change
anymore.
2011-02-19 22:49:20 +01:00
58e3e43c15 Change voltage source symbols. 2011-02-19 22:49:20 +01:00
fdb6418733 Reset view to center for new diagrams. 2011-02-19 22:49:20 +01:00
6820d27efa Add "x" and "y" properties to LdDiagramView.
Plus a bit of refactoring.
2011-02-19 22:49:20 +01:00
781273c236 Open files from command line. 2011-02-19 22:49:20 +01:00
7fa6efbaec Rename LdCanvas to LdDiagramView. 2011-02-19 22:49:20 +01:00
6a8238846c Add a symbol for junctions. 2011-02-19 22:49:20 +01:00
412a01690b Change selection color to red.
To make it more distinctive.
2011-02-19 22:49:20 +01:00
841e9e9f85 Fix README.
The sentence about goals doesn't seem to have any sense.
2011-02-19 22:48:22 +01:00
ac56c16ab8 Update the symbol library. 2011-02-14 10:46:57 +01:00
baed5ee4bd Allow rotation of symbols.
Bind this action to the right mouse button.

Due to limitations of json-glib, we can't store rotation as an enum.
2011-02-14 10:14:28 +01:00
5ccabad6ce Emit "cancel-operation", don't call the handler. 2011-02-14 08:46:41 +01:00
1730064ed3 Avoid too wide items in symbol menus. 2011-02-14 08:21:30 +01:00
8ac4674a8e Fix ld-types.h for gtk-doc. 2011-02-14 06:41:08 +01:00
0841e75076 Change the current directory on Windows.
So the application can always find it's files.
2011-02-13 21:14:24 +01:00
bc491d0d0f Update translations. 2011-02-13 20:55:03 +01:00
cffc6f01a5 Use gtk_init_with_args(). 2011-02-13 20:55:03 +01:00
ebd4cd3a17 Various changes to LdWindowMain.
* Convert filenames from system locale.
* Internationalize.
* Split diagram_show_open_dialog().
2011-02-13 20:17:21 +01:00
69f3ce89c5 Register the file type on Windows. 2011-02-13 17:51:56 +01:00
5fd66ada46 Add a header image for NSIS. 2011-02-13 17:46:53 +01:00
440a9da5fc Only install the MS-Windows GTK+ theme on Win32. 2011-02-12 18:54:54 +01:00
ee8a82925f Update json-glib checksums.
The files have been rebuilt or repacked.
2011-02-12 18:54:54 +01:00
66dc2948df Add Czech translation. 2011-02-12 18:54:42 +01:00
948e9d53d2 Update translation template. 2011-02-12 18:40:21 +01:00
9a217e97c8 Change the way translations are done.
* Require gettext-tools to build.
* Depend on libintl on Win32.
2011-02-12 18:40:16 +01:00
68e6e4a7e8 Make symbol menus nicer. 2011-02-12 18:26:27 +01:00
b7875c361f Update the symbol library, add trivial text API. 2011-02-12 18:26:15 +01:00
299ce010bd Update the symbol library.
* Add bipolar, IGFET and JFET transistors.
* Add more variants to some symbols.
* Add a symbol for a simple terminal.
* Avoid unneccessary stroke() calls.
* Fix comments.
2011-02-11 18:37:00 +01:00
2c5f2f5b3f Export more cairo functions to Lua.
Also rewrite the wrappers to be shorter.
2011-02-11 18:07:49 +01:00
d96acedcdb Speed up drawing of the grid. 2011-02-10 06:03:41 +01:00
39fb4bb56f Make all variables in Lua scripts local. 2011-02-09 14:18:22 +01:00
ab3e2733ce Add build instructions for Windows to README. 2011-02-08 10:56:00 +01:00
93bac99a10 Make CPack information more NSIS-friendly.
1. It's wont process UTF-8 correctly, so let's cripple my name.
2. Add a project URL, again in a crippled format.
2011-02-08 00:38:44 +01:00
da34bbb3bb Fix Win32Depends.cmake.
I've known about this all the time, hoping it's not a problem.
2011-02-07 23:28:55 +01:00
67 changed files with 4023 additions and 997 deletions

View File

@@ -16,7 +16,7 @@ endif (OPTION_NOINSTALL)
# Project information # Project information
set (project_VERSION_MAJOR "0") set (project_VERSION_MAJOR "0")
set (project_VERSION_MINOR "1") set (project_VERSION_MINOR "1")
set (project_VERSION_PATCH "0") set (project_VERSION_PATCH "2")
set (project_VERSION "${project_VERSION_MAJOR}") set (project_VERSION "${project_VERSION_MAJOR}")
set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}") set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}")
@@ -94,14 +94,16 @@ find_package (Lua51 REQUIRED)
find_package (JsonGlib REQUIRED) find_package (JsonGlib REQUIRED)
# Localization # Localization
find_package (Gettext) find_package (Gettext REQUIRED)
if (GETTEXT_FOUND) file (GLOB project_PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po)
set (HAVE_GETTEXT true) GETTEXT_CREATE_TRANSLATIONS (
file (GLOB project_TRANSLATIONS ${CMAKE_CURRENT_SOURCE_DIR}/po/*.po) ${CMAKE_CURRENT_SOURCE_DIR}/po/${CMAKE_PROJECT_NAME}.pot
GETTEXT_CREATE_TRANSLATIONS ( ALL ${project_PO_FILES})
${CMAKE_CURRENT_SOURCE_DIR}/po/${CMAKE_PROJECT_NAME}.pot
ALL ${project_TRANSLATIONS}) foreach (file ${project_PO_FILES})
endif (GETTEXT_FOUND) get_filename_component (translation "${file}" NAME_WE)
list (APPEND project_TRANSLATIONS "${translation}")
endforeach (file)
# Documentation # Documentation
# TODO: Add pregenerated docs to the tree # TODO: Add pregenerated docs to the tree
@@ -117,7 +119,7 @@ set (liblogdiag_SOURCES
liblogdiag/ld-diagram-object.c liblogdiag/ld-diagram-object.c
liblogdiag/ld-diagram-symbol.c liblogdiag/ld-diagram-symbol.c
liblogdiag/ld-diagram-connection.c liblogdiag/ld-diagram-connection.c
liblogdiag/ld-canvas.c liblogdiag/ld-diagram-view.c
liblogdiag/ld-library.c liblogdiag/ld-library.c
liblogdiag/ld-library-toolbar.c liblogdiag/ld-library-toolbar.c
liblogdiag/ld-symbol-category.c liblogdiag/ld-symbol-category.c
@@ -134,7 +136,7 @@ set (liblogdiag_HEADERS
liblogdiag/ld-diagram-object.h liblogdiag/ld-diagram-object.h
liblogdiag/ld-diagram-symbol.h liblogdiag/ld-diagram-symbol.h
liblogdiag/ld-diagram-connection.h liblogdiag/ld-diagram-connection.h
liblogdiag/ld-canvas.h liblogdiag/ld-diagram-view.h
liblogdiag/ld-library.h liblogdiag/ld-library.h
liblogdiag/ld-library-toolbar.h liblogdiag/ld-library-toolbar.h
liblogdiag/ld-symbol-category.h liblogdiag/ld-symbol-category.h
@@ -218,6 +220,11 @@ include_directories (${GTK2_INCLUDE_DIRS}
set (logdiag_LIBS ${GTK2_LIBRARIES} set (logdiag_LIBS ${GTK2_LIBRARIES}
${JSON_GLIB_LIBRARIES} ${LUA_LIBRARIES}) ${JSON_GLIB_LIBRARIES} ${LUA_LIBRARIES})
if (WIN32)
find_package (LibIntl REQUIRED)
list (APPEND logdiag_LIBS ${LIBINTL_LIBRARIES})
endif (WIN32)
# Build the library # Build the library
add_library (liblogdiag STATIC ${liblogdiag_SOURCES} ${liblogdiag_HEADERS}) add_library (liblogdiag STATIC ${liblogdiag_SOURCES} ${liblogdiag_HEADERS})
set_target_properties (liblogdiag PROPERTIES OUTPUT_NAME logdiag) set_target_properties (liblogdiag PROPERTIES OUTPUT_NAME logdiag)
@@ -258,7 +265,8 @@ if (WIN32)
install (DIRECTORY install (DIRECTORY
${WIN32_DEPENDS_PATH}/bin/ ${WIN32_DEPENDS_PATH}/bin/
DESTINATION . DESTINATION .
FILES_MATCHING PATTERN "*.dll") FILES_MATCHING PATTERN "*.dll"
PATTERN "libgettext*" EXCLUDE)
install (DIRECTORY install (DIRECTORY
${WIN32_DEPENDS_PATH}/etc/ ${WIN32_DEPENDS_PATH}/etc/
DESTINATION etc) DESTINATION etc)
@@ -268,9 +276,20 @@ if (WIN32)
${WIN32_DEPENDS_PATH}/lib/gdk-pixbuf-2.0 ${WIN32_DEPENDS_PATH}/lib/gdk-pixbuf-2.0
DESTINATION lib) DESTINATION lib)
install (DIRECTORY install (DIRECTORY
${WIN32_DEPENDS_PATH}/share/locale ${WIN32_DEPENDS_PATH}/share/themes/MS-Windows
${WIN32_DEPENDS_PATH}/share/themes DESTINATION share/themes)
DESTINATION share)
# Avoid partial translations
file (GLOB locales ${WIN32_DEPENDS_PATH}/share/locale/*)
foreach (locale ${locales})
get_filename_component (translation ${locale} NAME)
list (FIND project_TRANSLATIONS ${translation} translation_found)
if (translation_found GREATER -1)
install (DIRECTORY
${WIN32_DEPENDS_PATH}/share/locale/${translation}
DESTINATION share/locale)
endif (translation_found GREATER -1)
endforeach (locale)
else (WIN32) else (WIN32)
install (TARGETS logdiag DESTINATION bin) install (TARGETS logdiag DESTINATION bin)
install (FILES share/logdiag.desktop DESTINATION share/applications) install (FILES share/logdiag.desktop DESTINATION share/applications)
@@ -279,12 +298,12 @@ else (WIN32)
# Don't install the documentation yet as we don't install any library # Don't install the documentation yet as we don't install any library
# install (DIRECTORY "${project_DOC_DIR}/html/" # install (DIRECTORY "${project_DOC_DIR}/html/"
# DESTINATION share/gtk-doc/html/${CMAKE_PROJECT_NAME}) # DESTINATION share/gtk-doc/html/${CMAKE_PROJECT_NAME})
install (FILES LICENSE DESTINATION share/doc/${CMAKE_PROJECT_NAME}) install (FILES LICENSE NEWS DESTINATION share/doc/${CMAKE_PROJECT_NAME})
endif (WIN32) endif (WIN32)
# CPack # CPack
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Schematic editor") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Schematic editor")
set (CPACK_PACKAGE_VENDOR "Přemysl Janouch") set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
set (CPACK_PACKAGE_CONTACT "p.janouch@gmail.com") set (CPACK_PACKAGE_CONTACT "p.janouch@gmail.com")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR}) set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
@@ -302,11 +321,25 @@ set (CPACK_PACKAGE_FILE_NAME
set (CPACK_PACKAGE_INSTALL_DIRECTORY set (CPACK_PACKAGE_INSTALL_DIRECTORY
"${CMAKE_PROJECT_NAME} ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") "${CMAKE_PROJECT_NAME} ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
# FIXME: It is possible to install multiple copies. Everything screws up then.
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/share\\\\header.bmp")
set (CPACK_NSIS_INSTALLED_ICON_NAME "logdiag.exe") set (CPACK_NSIS_INSTALLED_ICON_NAME "logdiag.exe")
set (CPACK_NSIS_CREATE_ICONS_EXTRA set (CPACK_NSIS_CREATE_ICONS_EXTRA "
"CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\logdiag.lnk' '\$INSTDIR\\\\logdiag.exe'") CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\logdiag.lnk' '\$INSTDIR\\\\logdiag.exe'")
set (CPACK_NSIS_DELETE_ICONS_EXTRA set (CPACK_NSIS_DELETE_ICONS_EXTRA "
"Delete '\$SMPROGRAMS\\\\$MUI_TEMP\\\\logdiag.lnk'") Delete '\$SMPROGRAMS\\\\$MUI_TEMP\\\\logdiag.lnk'")
set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
WriteRegStr HKCR '.ldd' '' 'logdiag.Diagram'
WriteRegStr HKCR 'logdiag.Diagram' '' 'logdiag Diagram'
WriteRegStr HKCR 'logdiag.Diagram\\\\shell\\\\open\\\\command' '' '\\\"\$INSTDIR\\\\logdiag.exe\\\" \\\"%1\\\"'
WriteRegStr HKCR 'logdiag.Diagram\\\\shell\\\\edit\\\\command' '' '\\\"\$INSTDIR\\\\logdiag.exe\\\" \\\"%1\\\"'
System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'")
set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
DeleteRegKey HKCR 'logdiag.Diagram'
System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'")
string (REPLACE "http://" "http:\\\\\\\\" project_URL_NSIS "${project_URL}")
set (CPACK_NSIS_URL_INFO_ABOUT "${project_URL_NSIS}")
set (CPACK_DEBIAN_PACKAGE_DEPENDS set (CPACK_DEBIAN_PACKAGE_DEPENDS
"libgtk2.0-0 (>= 2.12), libjson-glib-1.0-0 (>= 0.10.4), liblua5.1-0, librsvg2-common") "libgtk2.0-0 (>= 2.12), libjson-glib-1.0-0 (>= 0.10.4), liblua5.1-0, librsvg2-common")

17
NEWS
View File

@@ -1,3 +1,20 @@
Version 0.1.2
- Updated symbol library.
- Added Slovak, Polish and German translations.
- Rotation of symbols is also allowed while placing them.
- Now gluing to terminal points when creating connections.
- Toolbars and the grid can be hidden.
Version 0.1.1
- Rotation of symbols made possible.
- Connections can also be created at ends of other connections.
- Added more symbols.
- Internationalization, added Czech translation.
- Visual enhancement of symbol menus.
- The grid is drawn much faster.
- Diagrams can be opened from command line.
- The diagram file type is registered on Windows.
Version 0.1.0 Version 0.1.0
- The first release. - The first release.

View File

@@ -1,7 +1,6 @@
# logdiag # logdiag
logdiag is a schematic editor written in GTK+. It focuses on simplicity, logdiag is a schematic editor written in GTK+.
usability and openness.
__This software is considered to be alpha quality and cannot be recommended __This software is considered to be alpha quality and cannot be recommended
for regular usage.__ for regular usage.__
@@ -44,3 +43,29 @@ Now you have two basic choices of installing the application:
$ cpack -G DEB $ cpack -G DEB
# dpkg -i logdiag-0.0-Linux-x86_64.deb # dpkg -i logdiag-0.0-Linux-x86_64.deb
# Building from sources on Windows
First install CMake 2.8 and MinGW. Add both to the system path.
If you want to build an installation package, also install NSIS.
Run the following command in the directory with source files
to automatically fetch and setup all dependencies:
> cmake -P Win32Depends.cmake
Reserve a directory for an out-of-source build:
> mkdir build
> cd build
Let CMake prepare the build:
> cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
Now you can generate a package with CPack. You may choose between:
1. An NSIS-based installation package:
> cpack -G NSIS
2. A portable ZIP package:
> cpack -G ZIP
By default, that is if you specify no generator, both packages are built.

View File

@@ -44,7 +44,8 @@ set (pkg_gtk_urls
"${pkg_gtk_root}/librsvg/2.32/svg-gdk-pixbuf-loader_2.32.1-1_win32.zip" "${pkg_gtk_root}/librsvg/2.32/svg-gdk-pixbuf-loader_2.32.1-1_win32.zip"
"${pkg_gtk_root}/libcroco/0.6/libcroco_0.6.2-1_win32.zip" "${pkg_gtk_root}/libcroco/0.6/libcroco_0.6.2-1_win32.zip"
"${pkg_gtk_root}/dependencies/libxml2_2.7.7-1_win32.zip" "${pkg_gtk_root}/dependencies/libxml2_2.7.7-1_win32.zip"
"${pkg_gtk_root}/dependencies/libxml2-dev_2.7.7-1_win32.zip") "${pkg_gtk_root}/dependencies/libxml2-dev_2.7.7-1_win32.zip"
"${pkg_gtk_root}/dependencies/gettext-tools-0.17.zip")
set (pkg_gtk_md5 set (pkg_gtk_md5
"a545c0ca1e6a312701d42a18e49572af" "a545c0ca1e6a312701d42a18e49572af"
"2c712a8d7a652363241c0967098515db" "2c712a8d7a652363241c0967098515db"
@@ -52,16 +53,17 @@ set (pkg_gtk_md5
"bf4e34f1f175b88430159d33e01d0c49" "bf4e34f1f175b88430159d33e01d0c49"
"2d90c71404be0de4e5f3259f63a3e278" "2d90c71404be0de4e5f3259f63a3e278"
"bd6b3d8c35e06a00937db65887c6e287" "bd6b3d8c35e06a00937db65887c6e287"
"b6f59b70eef0992df37f8db891d4b283") "b6f59b70eef0992df37f8db891d4b283"
"09baff956ebd1c391c7f71e9bd768edd")
set (pkg_opensuse_root "http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Factory/noarch") set (pkg_opensuse_root "http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Factory/noarch")
set (pkg_opensuse_urls set (pkg_opensuse_urls
"${pkg_opensuse_root}/mingw32-libjson-glib-0.12.0-2.38.noarch.rpm" "${pkg_opensuse_root}/mingw32-libjson-glib-0.12.0-3.1.noarch.rpm"
"${pkg_opensuse_root}/mingw32-json-glib-devel-0.12.0-2.38.noarch.rpm") "${pkg_opensuse_root}/mingw32-json-glib-devel-0.12.0-3.1.noarch.rpm")
set (pkg_opensuse_strip "usr/i686-pc-mingw32/sys-root/mingw") set (pkg_opensuse_strip "usr/i686-pc-mingw32/sys-root/mingw")
set (pkg_opensuse_md5 set (pkg_opensuse_md5
"2ca72896a3888c9081104e16a996a234" "df41a913984b865a46d234ad59703c8c"
"1c50ab8368b54f9ddf14dbca001477b9") "13702ee3e22f79f42948ec5cbb6e23cb")
set (pkg_mingw_lua_root "http://sourceforge.net/projects/mingw-cross/files/%5BLIB%5D%20Lua") set (pkg_mingw_lua_root "http://sourceforge.net/projects/mingw-cross/files/%5BLIB%5D%20Lua")
set (pkg_mingw_lua_name "mingw32-lua-5.1.4-2") set (pkg_mingw_lua_name "mingw32-lua-5.1.4-2")
@@ -156,11 +158,12 @@ endforeach (pkg_set)
file (WRITE ${working_dir}/etc/gtk-2.0/gtkrc file (WRITE ${working_dir}/etc/gtk-2.0/gtkrc
"gtk-theme-name = \"MS-Windows\"") "gtk-theme-name = \"MS-Windows\"")
set (gdk_pixbuf_libdir ${working_dir}/lib/gdk-pixbuf-2.0/2.10.0) set (gdk_pixbuf_libdir lib/gdk-pixbuf-2.0/2.10.0)
set (ENV{GDK_PIXBUF_MODULE_FILE} ${gdk_pixbuf_libdir}/loaders.cache) set (ENV{GDK_PIXBUF_MODULE_FILE} ${gdk_pixbuf_libdir}/loaders.cache)
set (ENV{GDK_PIXBUF_MODULEDIR} ${gdk_pixbuf_libdir}/loaders) set (ENV{GDK_PIXBUF_MODULEDIR} ${gdk_pixbuf_libdir}/loaders)
execute_process (COMMAND execute_process (COMMAND
${working_dir}/bin/gdk-pixbuf-query-loaders --update-cache ${working_dir}/bin/gdk-pixbuf-query-loaders --update-cache
WORKING_DIRECTORY "${working_dir}"
RESULT_VARIABLE result) RESULT_VARIABLE result)
if (result) if (result)
message (FATAL_ERROR "gdk-pixbuf-query-loaders failed") message (FATAL_ERROR "gdk-pixbuf-query-loaders failed")

View File

@@ -447,6 +447,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h)
_GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true) _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true)
_GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo false true)
_GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h) _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h)
_GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true) _GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true)

View File

@@ -14,7 +14,7 @@
#============================================================================= #=============================================================================
# Copyright 2007-2009 Kitware, Inc. # Copyright 2007-2009 Kitware, Inc.
# Copyright 2010 Přemysl Janouch # Copyright 2010-2011 Přemysl Janouch
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
@@ -41,7 +41,6 @@
#============================================================================= #=============================================================================
find_program (GETTEXT_MSGMERGE_EXECUTABLE msgmerge) find_program (GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
find_program (GETTEXT_MSGFMT_EXECUTABLE msgfmt) find_program (GETTEXT_MSGFMT_EXECUTABLE msgfmt)
macro (GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) macro (GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
@@ -93,13 +92,8 @@ macro (GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
DEPENDS ${_gmoFiles}) DEPENDS ${_gmoFiles})
endmacro (GETTEXT_CREATE_TRANSLATIONS) endmacro (GETTEXT_CREATE_TRANSLATIONS)
if (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE) include (FindPackageHandleStandardArgs)
set (GETTEXT_FOUND TRUE) FIND_PACKAGE_HANDLE_STANDARD_ARGS (Gettext DEFAULT_MSG
else (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE) GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE)
set (GETTEXT_FOUND FALSE)
if (GetText_REQUIRED)
message (FATAL_ERROR "GetText not found")
endif (GetText_REQUIRED)
endif (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)

38
cmake/FindLibIntl.cmake Normal file
View File

@@ -0,0 +1,38 @@
# - Find libintl
# This module looks for libintl.
# This module defines the following values:
# LIBINTL_FOUND
# LIBINTL_LIBRARIES
#=============================================================================
# Copyright Přemysl Janouch 2011
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGE.
#=============================================================================
find_library (LIBINTL_LIBRARIES intl)
include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (LibIntl DEFAULT_MSG LIBINTL_LIBRARIES)
mark_as_advanced (LIBINTL_LIBRARIES)

View File

@@ -25,22 +25,15 @@
#cmakedefine HAVE_SANE___RESTRICT #cmakedefine HAVE_SANE___RESTRICT
#cmakedefine HAVE_RESTRICT #cmakedefine HAVE_RESTRICT
#cmakedefine HAVE_GETTEXT
#include <glib/gi18n.h>
#define Q_(s) (s) #define GETTEXT_DOMAIN "${PROJECT_NAME}"
#ifdef HAVE_GETTEXT #ifdef _WIN32
#include <locale.h> #define GETTEXT_DIRNAME "share/locale"
#include <libintl.h> #else
#define _(s) gettext(s)
#define N_(s1, s2, n) ngettext(s1, s2, n)
#define GETTEXT_DOMAIN "${PROJECT_NAME}"
#define GETTEXT_DIRNAME "${CMAKE_INSTALL_PREFIX}/share/locale" #define GETTEXT_DIRNAME "${CMAKE_INSTALL_PREFIX}/share/locale"
#else /* ! HAVE_GETTEXT */ #endif
#define _(s) (s)
#define N_(s1, s2, n) ((n) == 1 ? (s1) : (s2))
#endif /* ! HAVE_GETTEXT */
#ifndef HAVE_SANE___RESTRICT #ifndef HAVE_SANE___RESTRICT

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
docs/user-guide/github.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,148 @@
%&program=xelatex
%&encoding=UTF-8 Unicode
\documentclass[12pt,oneside,a4paper,titlepage,final]{article}
\usepackage{fontspec}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[czech]{babel}
\usepackage[pdfborder={0 0 0},pdfpagelabels=true,plainpages=false]{hyperref}
\usepackage[all]{hypcap}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheoremstyle{note}{\parskip}{0pt}{}{\parindent}{\bfseries}{:}{.5em}{}
\theoremstyle{note}
\newtheorem*{warning}{Pozor}
% Better quotations
\renewcommand*{\uv}[1]{\quotedblbase #1\textquotedblleft}
% Metadata
\newcommand{\gettitle}{logdiag}
\newcommand{\getsubtitle}{Průvodce uživatele}
\newcommand{\getauthor}{Přemysl Janouch}
\newcommand{\getdate}{6. března 2011}
\hypersetup{pdftitle={\gettitle{} --- \getsubtitle},pdfauthor={\getauthor}}
\begin{document}
% Number the first pages with roman numerals
\renewcommand{\thepage}{\roman{page}}
% The title page has no header or footer at all
\thispagestyle{empty}
\begin{center}
\doublespacing
\textbf{\LARGE\gettitle}\\{\Large\getsubtitle}
\par\getauthor
\par\getdate
\vfill
\includegraphics{logdiag-cs}
\newpage
\end{center}
\tableofcontents
\newpage
% Number the real content with arabic numerals and show them in the footer
\renewcommand{\thepage}{\arabic{page}}
\setcounter{page}{1}
\section{Úvod}
Tento dokument vás má za účel provést po aplikaci a~pomoci vám se v~ní zorientovat. Popis úkonů se přednostně vztahuje na operační systém Microsoft Windows, do jisté míry je však platný i~pro jiné operační systémy.
\section{Získání aplikace}
Nejnovější verzi aplikace je možné stáhnout na následující webové adrese: \mbox{\url{http://github.com/pjanouch/logdiag}}.
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth,keepaspectratio]{github}
\caption{Nabídka pro stahování na githubu}
\label{github-download}
\end{figure}
Až se ocitnete na githubu, vyhledejte po pravé straně tlačítko s~nápisem \uv{Downloads}, případně \uv{Soubory ke stažení}, a~klepněte na něj. Zobrazí se před vámi nabídka balíčků. Instalační soubor pro Microsoft Windows nese název ve stylu \uv{logdiag-\emph{verze}-Windows-x86.exe}.
\section{Instalace}
Proces instalace je velmi přímočarý. Po úvodní obrazovce je vyžadován souhlas s~licencí. Pokud nerozumíte anglicky, její stručné shrnutí zní, že aplikaci smíte v~nezměněné formě zcela volně používat a~redistribuovat, ale nejsou vám poskytovány žádné záruky. Následuje výběr složky, do které chcete aplikaci nainstalovat, a~složky pro umístění ve Start menu. V~případě, že nenastala žádná náhlá chyba, už jen stačí potvrdit úspěšnou instalaci.
\begin{warning}
Pokud aplikaci instalujete do složky, kde se nachází již existující instalace, mohou nastat potíže. Ačkoliv je to možné, nepokoušejte se z~těch samých příčin instalovat ani více kopií vedle sebe. Nejdříve stávající instalaci odstraňte, například pomocí zástupce umístěného ve Start menu.
\end{warning}
\section{Operace s~objekty}
% TODO: Zkusit restrukturalizovat na:
% 4. Operace s objekty
% 4.1 Základní operace
% 4.1.1 Výběr
% 4.1.2 Přesun
% 4.1.3 Odstranění
% 4.2 Značky
% 4.2.1 Vložení
% 4.2.2 Otáčení
% 4.3 Spojení
% 4.3.1 Tvorba
%
Každý diagram je tvořen z~objektů, a~s~těmi se sdružují dále popsané operace. Budete-li chtít momentálně prováděnou operaci zrušit, můžete tak obvykle učinit stiskem klávesy Escape.
\subsection{Výběr objektů}
Jednotlivé objekty můžete vybírat levým kliknutím myší. Ty se v~reakci na to vyznačí červenou barvou. Chcete-li vybrat objektů více, držte během klikání stisknutou klávesu Shift.
\begin{figure}[ht]
\centering
\includegraphics{select-objects}
\caption{Výběr objektů v~oblasti}
\label{select-objects}
\end{figure}
Alternativně můžete táhnout myší z~volné oblasti diagramu do prostoru, viz obrázek \ref{select-objects}. Vyberou se objekty obsažené ve vytvořeném obdélníku. Výběr lze zrušit klepnutím na prázdné místo.
\subsection{Přesun objektů}
Přesun objektů se provede tažením objektů myší na požadované místo. Pokud jsou tyto objekty součástí výběru, přesune se celý výběr. Ten lze též přesouvat pomocí kurzorových kláves.
\subsection{Odstranění objektů}
Objekty odstraníte stisknutím klávesy Delete, případně z~menu aplikace.
\subsection{Vložení značky}
\emph{Značky} představují nejdůležitější druh objektů. Do diagramu je vložíte výběrem z~nabídky značek umístěné po~levé straně hlavního okna aplikace, viz obrázek \ref{select-symbol}. Po kliknutí na vámi vybranou značku klikněte znovu do diagramu na místo, kde ji chcete umístit.
\begin{figure}[ht]
\centering
\includegraphics{select-symbol}
\caption{Výběr značky z~nabídky}
\label{select-symbol}
\end{figure}
\subsection{Otáčení značek}
Otočit značku vloženou do diagramu můžete přes pravé tlačítko myši.
\subsection{Propojení terminálů}
\emph{Terminálem} se nazývá bod určený pro tvorbu spojení mezi značkami nebo jinými spojeními. Abyste z~něj spojení vyvedli, nejdříve na něj najeďte kurzorem myši tak, aby se viditelně vyznačil kroužkem. Pak stiskněte levé tlačítko myši a~přetáhněte kurzor myši na místo, kde chcete, aby spojení končilo.
\begin{figure}[ht]
\centering
\includegraphics{create-connection-begin} \hspace{15pt} \includegraphics{create-connection-end}
\caption{Propojení terminálů dvou značek}
\label{create-connection}
\end{figure}
\section{Časté problémy}
\subsection{Nelze otevřít uložený diagram}
Při ukládání se ujistěte, že zadaný název souboru obsahuje příponu \uv{.ldd}. V~opačném případě se nezobrazí v~dialogu pro otevření diagramu. Pokud jste nějaký soubor již bez přípony uložili, napravíte to dodatečným přidáním přípony k~jeho názvu.
\subsection{Jak můžu diagram vytisknout?}
Současná verze aplikace není schopná přímo tisknout. Pro vytištění vytvořeného diagramu můžete klávesou PrintScreen sejmout snímek obrazovky, vložit jej například do aplikace Malování, oříznout požadovanou část a~vytisknout ji z~tohoto grafického editoru.
\subsection{Schází mi popisky}
Obdobně jako v~předchozím případě tato funkcionalita zatím neexistuje, ale je možné tento nedostatek obejít přes běžný grafický editor.
\end{document}

View File

@@ -0,0 +1,134 @@
%&program=xelatex
%&encoding=UTF-8 Unicode
\documentclass[12pt,oneside,a4paper,titlepage,final]{article}
\usepackage{fontspec}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage[pdfborder={0 0 0},pdfpagelabels=true,plainpages=false]{hyperref}
\usepackage[all]{hypcap}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheoremstyle{note}{\parskip}{0pt}{}{\parindent}{\bfseries}{:}{.5em}{}
\theoremstyle{note}
\newtheorem*{warning}{Warning}
% Better quotations
\newcommand*{\uv}[1]{"#1"}
% Metadata
\newcommand{\gettitle}{logdiag}
\newcommand{\getsubtitle}{User Guide}
\newcommand{\getauthor}{Přemysl Janouch}
\newcommand{\getdate}{6. March 2011}
\hypersetup{pdftitle={\gettitle{} --- \getsubtitle},pdfauthor={\getauthor}}
\begin{document}
% Number the first pages with roman numerals
\renewcommand{\thepage}{\roman{page}}
% The title page has no header or footer at all
\thispagestyle{empty}
\begin{center}
\doublespacing
\textbf{\LARGE\gettitle}\\{\Large\getsubtitle}
\par\getauthor
\par\getdate
\vfill
\includegraphics{logdiag-en}
\newpage
\end{center}
\tableofcontents
\newpage
% Number the real content with arabic numerals and show them in the footer
\renewcommand{\thepage}{\arabic{page}}
\setcounter{page}{1}
\section{Introduction}
This document will guide you through the application and help to familiarize you with it. The description of tasks is preferentially related to the Microsoft Windows operating system, though it's also valid for other operating systems to a certain extent.
\section{Getting the application}
Download the newest version of the application at the following web address: \mbox{\url{http://github.com/pjanouch/logdiag}}.
\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth,keepaspectratio]{github}
\caption{The download menu at github}
\label{github-download}
\end{figure}
While at github, look for a button entitled \uv{Downloads} at the right side of the page and click on it. A menu with packages appears. The installation file for Microsoft Windows is named \uv{logdiag-\emph{version}-Windows-x86.exe}.
\section{Installation}
The installation process is quite straight-forward. After the initial screen the license agreement is required. Next, choose a folder in which to install the application and another one for placement in the Start menu. As long as no unexpected error has occurred, all that's left is confirming a successful installation.
\begin{warning}
If the application is installed to a folder where a previous installation is already located, problems may arise. Although it is possible to do so, don't try to install multiple copies parallely either, for the same reasons. Remove the current installation first, for example by using the shortcut located in the Start menu.
\end{warning}
\section{Operations with objects}
Each diagram consists of objects, and these are joined with the operations described below. To cancel any current operation, press the Escape key.
\subsection{Selecting objects}
Select single objects by left-clicking on them. They will get highlighted with red color in reaction to this. To select multiple objects, hold the Shift key while clicking.
\begin{figure}[ht]
\centering
\includegraphics{select-objects}
\caption{Selecting objects inside an area}
\label{select-objects}
\end{figure}
Alternatively drag the mouse from free space within the diagram into the area, see figure \ref{select-objects}. Objects contained in this rectangle will be selected. The selection may later be dismissed by just clicking into free space.
\subsection{Moving objects}
Moving of objects is done by dragging them with the mouse onto the desired place. If these objects form a part of the current selection, the whole selection is moved. The selection may also be moved using cursor keys.
\subsection{Removing objects}
Remove objects either by pressing the Delete key or from the application menu.
\subsection{Inserting symbols}
\emph{Symbols} constitute the most important kind of objects. Insert them into the diagram by choosing one from the symbol menu located at the left side of the main application window, see figure \ref{select-symbol}. After clicking on a symbol, click again into the diagram where the symbol is to be placed.
\begin{figure}[ht]
\centering
\includegraphics{select-symbol}
\caption{Choosing a symbol from the menu}
\label{select-symbol}
\end{figure}
\subsection{Rotating symbols}
Rotate a symbol inserted into the diagram by right-clicking on it.
\subsection{Connecting terminals}
A point intended for creation of connections between symbols or other connections is called a \emph{terminal}. To lead a connection out of it, first hover it with the mouse pointer, so it gets visibly highlighted with a circle. Then press the left mouse button and drag the pointer onto the place where you want the connection to end.
\begin{figure}[ht]
\centering
\includegraphics{create-connection-begin} \hspace{15pt} \includegraphics{create-connection-end}
\caption{Interconnecting terminals of two symbols}
\label{create-connection}
\end{figure}
\section{Frequent problems}
\subsection{Can't open a saved diagram}
When saving, assure that the filename you've typed in contains the \uv{.ldd} suffix. If not, it won't show up in the dialog for opening diagrams. In case you've already saved a file without an extension, you may fix this situation by adding the suffix to its name.
\subsection{How do I print a diagram?}
The current version of application is not able to print directly. To print out a created diagram, you may use the PrintScreen key to capture a screenshot, then insert it to, for example, Paint, and print it from inside the graphics editor.
\subsection{I miss labels}
Similarly to the previous case, this functionality doesn't exist yet, but it is possible to get around this limitation via a regular graphics editor.
\end{document}

View File

@@ -1,95 +0,0 @@
/*
* ld-canvas.h
*
* This file is a part of logdiag.
* Copyright Přemysl Janouch 2010 - 2011. All rights reserved.
*
* See the file LICENSE for licensing information.
*
*/
#ifndef __LD_CANVAS_H__
#define __LD_CANVAS_H__
G_BEGIN_DECLS
#define LD_TYPE_CANVAS (ld_canvas_get_type ())
#define LD_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_CANVAS, LdCanvas))
#define LD_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_CANVAS, LdCanvasClass))
#define LD_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_CANVAS))
#define LD_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_CANVAS))
#define LD_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_CANVAS, LdCanvasClass))
typedef struct _LdCanvas LdCanvas;
typedef struct _LdCanvasPrivate LdCanvasPrivate;
typedef struct _LdCanvasClass LdCanvasClass;
/**
* LdCanvas:
*/
struct _LdCanvas
{
/*< private >*/
GtkDrawingArea parent_instance;
LdCanvasPrivate *priv;
};
struct _LdCanvasClass
{
/*< private >*/
GtkDrawingAreaClass parent_class;
guint cancel_operation_signal;
guint move_signal;
void (*set_scroll_adjustments) (LdCanvas *self,
GtkAdjustment *horizontal, GtkAdjustment *vertical);
void (*cancel_operation) (LdCanvas *self);
void (*move) (LdCanvas *self, gdouble dx, gdouble dy);
};
/**
* LD_CANVAS_BASE_UNIT_LENGTH:
*
* Length of the base unit in milimetres.
*/
#define LD_CANVAS_BASE_UNIT_LENGTH 2.5
GType ld_canvas_get_type (void) G_GNUC_CONST;
GtkWidget *ld_canvas_new (void);
void ld_canvas_set_diagram (LdCanvas *self, LdDiagram *diagram);
LdDiagram *ld_canvas_get_diagram (LdCanvas *self);
void ld_canvas_set_library (LdCanvas *self, LdLibrary *library);
LdLibrary *ld_canvas_get_library (LdCanvas *self);
void ld_canvas_widget_to_diagram_coords (LdCanvas *self,
gdouble wx, gdouble wy, gdouble *dx, gdouble *dy);
void ld_canvas_diagram_to_widget_coords (LdCanvas *self,
gdouble dx, gdouble dy, gdouble *wx, gdouble *wy);
gdouble ld_canvas_get_zoom (LdCanvas *self);
void ld_canvas_set_zoom (LdCanvas *self, gdouble zoom);
gboolean ld_canvas_can_zoom_in (LdCanvas *self);
void ld_canvas_zoom_in (LdCanvas *self);
gboolean ld_canvas_can_zoom_out (LdCanvas *self);
void ld_canvas_zoom_out (LdCanvas *self);
void ld_canvas_add_object_begin (LdCanvas *self, LdDiagramObject *object);
/* TODO: The rest of the interface. */
G_END_DECLS
#endif /* ! __LD_CANVAS_H__ */

View File

@@ -17,7 +17,7 @@
/** /**
* SECTION:ld-diagram-object * SECTION:ld-diagram-object
* @short_description: A diagram object * @short_description: A diagram object
* @see_also: #LdDiagram, #LdCanvas * @see_also: #LdDiagram, #LdDiagramView
* *
* #LdDiagramObject represents an object in an #LdDiagram. * #LdDiagramObject represents an object in an #LdDiagram.
*/ */
@@ -25,10 +25,12 @@
/* /*
* LdDiagramObjectPrivate: * LdDiagramObjectPrivate:
* @storage: storage for object parameters. * @storage: storage for object parameters.
* @lock_history: lock emitting of changes.
*/ */
struct _LdDiagramObjectPrivate struct _LdDiagramObjectPrivate
{ {
JsonObject *storage; JsonObject *storage;
gboolean lock_history;
}; };
typedef struct _SetParamActionData SetParamActionData; typedef struct _SetParamActionData SetParamActionData;
@@ -309,7 +311,10 @@ ld_diagram_object_get_data_warn:
ld_diagram_object_get_data_default: ld_diagram_object_get_data_default:
g_param_value_set_default (pspec, data); g_param_value_set_default (pspec, data);
self->priv->lock_history = TRUE;
g_object_set_property (G_OBJECT (self), name, data); g_object_set_property (G_OBJECT (self), name, data);
self->priv->lock_history = FALSE;
} }
/** /**
@@ -328,7 +333,7 @@ ld_diagram_object_set_data_for_param (LdDiagramObject *self,
SetParamActionData *action_data; SetParamActionData *action_data;
JsonObject *storage; JsonObject *storage;
const gchar *name; const gchar *name;
JsonNode *node; JsonNode *new_node, *old_node;
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (self)); g_return_if_fail (LD_IS_DIAGRAM_OBJECT (self));
g_return_if_fail (G_IS_VALUE (data)); g_return_if_fail (G_IS_VALUE (data));
@@ -337,23 +342,31 @@ ld_diagram_object_set_data_for_param (LdDiagramObject *self,
storage = ld_diagram_object_get_storage (self); storage = ld_diagram_object_get_storage (self);
name = g_param_spec_get_name (pspec); name = g_param_spec_get_name (pspec);
action_data = g_slice_new (SetParamActionData); if (!self->priv->lock_history)
action_data->self = g_object_ref (self); {
action_data->param_name = g_strdup (g_param_spec_get_name (pspec)); action_data = g_slice_new (SetParamActionData);
action_data->self = g_object_ref (self);
action_data->param_name = g_strdup (g_param_spec_get_name (pspec));
node = json_object_get_member (storage, name); old_node = json_object_get_member (storage, name);
action_data->old_node = node ? json_node_copy (node) : NULL; action_data->old_node = old_node ? json_node_copy (old_node) : NULL;
}
node = json_node_new (JSON_NODE_VALUE); new_node = json_node_new (JSON_NODE_VALUE);
json_node_set_value (node, data); json_node_set_value (new_node, data);
action_data->new_node = json_node_copy (node);
json_object_set_member (storage, name, node); if (!self->priv->lock_history)
action_data->new_node = json_node_copy (new_node);
action = ld_undo_action_new (on_set_param_undo, on_set_param_redo, json_object_set_member (storage, name, new_node);
on_set_param_destroy, action_data);
ld_diagram_object_changed (self, action); if (!self->priv->lock_history)
g_object_unref (action); {
action = ld_undo_action_new (on_set_param_undo, on_set_param_redo,
on_set_param_destroy, action_data);
ld_diagram_object_changed (self, action);
g_object_unref (action);
}
} }
static void static void

View File

@@ -23,7 +23,8 @@
enum enum
{ {
PROP_0, PROP_0,
PROP_CLASS PROP_CLASS,
PROP_ROTATION
}; };
static void ld_diagram_symbol_get_property (GObject *object, guint property_id, static void ld_diagram_symbol_get_property (GObject *object, guint property_id,
@@ -53,6 +54,16 @@ ld_diagram_symbol_class_init (LdDiagramSymbolClass *klass)
"The class of this symbol.", "The class of this symbol.",
"", G_PARAM_READWRITE); "", G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_CLASS, pspec); g_object_class_install_property (object_class, PROP_CLASS, pspec);
/**
* LdDiagramSymbol:rotation:
*
* Rotation of this symbol.
*/
pspec = g_param_spec_int ("rotation", "Rotation",
"Rotation of this symbol.",
0, 3, 0, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_ROTATION, pspec);
} }
static void static void
@@ -70,6 +81,7 @@ ld_diagram_symbol_get_property (GObject *object, guint property_id,
switch (property_id) switch (property_id)
{ {
case PROP_CLASS: case PROP_CLASS:
case PROP_ROTATION:
ld_diagram_object_get_data_for_param (self, value, pspec); ld_diagram_object_get_data_for_param (self, value, pspec);
break; break;
default: default:
@@ -87,6 +99,7 @@ ld_diagram_symbol_set_property (GObject *object, guint property_id,
switch (property_id) switch (property_id)
{ {
case PROP_CLASS: case PROP_CLASS:
case PROP_ROTATION:
ld_diagram_object_set_data_for_param (self, value, pspec); ld_diagram_object_set_data_for_param (self, value, pspec);
break; break;
default: default:
@@ -139,3 +152,33 @@ ld_diagram_symbol_set_class (LdDiagramSymbol *self, const gchar *klass)
g_return_if_fail (LD_IS_DIAGRAM_SYMBOL (self)); g_return_if_fail (LD_IS_DIAGRAM_SYMBOL (self));
g_object_set (self, "class", klass, NULL); g_object_set (self, "class", klass, NULL);
} }
/**
* ld_diagram_symbol_get_rotation:
* @self: an #LdDiagramSymbol object.
*
* Return value: rotation of the symbol.
*/
gint
ld_diagram_symbol_get_rotation (LdDiagramSymbol *self)
{
gint rotation;
g_return_val_if_fail (LD_IS_DIAGRAM_SYMBOL (self), 0);
g_object_get (self, "rotation", &rotation, NULL);
return rotation;
}
/**
* ld_diagram_symbol_set_rotation:
* @self: an #LdDiagramSymbol object.
* @rotation: the rotation.
*
* Set rotation of the symbol.
*/
void
ld_diagram_symbol_set_rotation (LdDiagramSymbol *self, gint rotation)
{
g_return_if_fail (LD_IS_DIAGRAM_SYMBOL (self));
g_object_set (self, "rotation", rotation, NULL);
}

View File

@@ -50,11 +50,21 @@ struct _LdDiagramSymbolClass
}; };
enum
{
LD_DIAGRAM_SYMBOL_ROTATION_0,
LD_DIAGRAM_SYMBOL_ROTATION_90,
LD_DIAGRAM_SYMBOL_ROTATION_180,
LD_DIAGRAM_SYMBOL_ROTATION_270
};
GType ld_diagram_symbol_get_type (void) G_GNUC_CONST; GType ld_diagram_symbol_get_type (void) G_GNUC_CONST;
LdDiagramSymbol *ld_diagram_symbol_new (JsonObject *storage); LdDiagramSymbol *ld_diagram_symbol_new (JsonObject *storage);
gchar *ld_diagram_symbol_get_class (LdDiagramSymbol *self); gchar *ld_diagram_symbol_get_class (LdDiagramSymbol *self);
void ld_diagram_symbol_set_class (LdDiagramSymbol *self, const gchar *klass); void ld_diagram_symbol_set_class (LdDiagramSymbol *self, const gchar *klass);
gint ld_diagram_symbol_get_rotation (LdDiagramSymbol *self);
void ld_diagram_symbol_set_rotation (LdDiagramSymbol *self, gint rotation);
G_END_DECLS G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
/*
* ld-diagram-view.h
*
* This file is a part of logdiag.
* Copyright Přemysl Janouch 2010 - 2011. All rights reserved.
*
* See the file LICENSE for licensing information.
*
*/
#ifndef __LD_DIAGRAM_VIEW_H__
#define __LD_DIAGRAM_VIEW_H__
G_BEGIN_DECLS
#define LD_TYPE_DIAGRAM_VIEW (ld_diagram_view_get_type ())
#define LD_DIAGRAM_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_DIAGRAM_VIEW, LdDiagramView))
#define LD_DIAGRAM_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_DIAGRAM_VIEW, LdDiagramViewClass))
#define LD_IS_DIAGRAM_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_DIAGRAM_VIEW))
#define LD_IS_DIAGRAM_VIEW_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_DIAGRAM_VIEW))
#define LD_DIAGRAM_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_DIAGRAM_VIEW, LdDiagramViewClass))
typedef struct _LdDiagramView LdDiagramView;
typedef struct _LdDiagramViewPrivate LdDiagramViewPrivate;
typedef struct _LdDiagramViewClass LdDiagramViewClass;
/**
* LdDiagramView:
*/
struct _LdDiagramView
{
/*< private >*/
GtkDrawingArea parent_instance;
LdDiagramViewPrivate *priv;
};
struct _LdDiagramViewClass
{
/*< private >*/
GtkDrawingAreaClass parent_class;
guint cancel_operation_signal;
guint move_signal;
void (*set_scroll_adjustments) (LdDiagramView *self,
GtkAdjustment *horizontal, GtkAdjustment *vertical);
void (*cancel_operation) (LdDiagramView *self);
void (*move) (LdDiagramView *self, gdouble dx, gdouble dy);
};
/**
* LD_DIAGRAM_VIEW_BASE_UNIT_LENGTH:
*
* Length of the base unit in milimetres.
*/
#define LD_DIAGRAM_VIEW_BASE_UNIT_LENGTH 2.5
GType ld_diagram_view_get_type (void) G_GNUC_CONST;
GtkWidget *ld_diagram_view_new (void);
void ld_diagram_view_set_diagram (LdDiagramView *self, LdDiagram *diagram);
LdDiagram *ld_diagram_view_get_diagram (LdDiagramView *self);
void ld_diagram_view_set_library (LdDiagramView *self, LdLibrary *library);
LdLibrary *ld_diagram_view_get_library (LdDiagramView *self);
void ld_diagram_view_widget_to_diagram_coords (LdDiagramView *self,
gdouble wx, gdouble wy, gdouble *dx, gdouble *dy);
void ld_diagram_view_diagram_to_widget_coords (LdDiagramView *self,
gdouble dx, gdouble dy, gdouble *wx, gdouble *wy);
gdouble ld_diagram_view_get_x (LdDiagramView *self);
void ld_diagram_view_set_x (LdDiagramView *self, gdouble x);
gdouble ld_diagram_view_get_y (LdDiagramView *self);
void ld_diagram_view_set_y (LdDiagramView *self, gdouble y);
gdouble ld_diagram_view_get_zoom (LdDiagramView *self);
void ld_diagram_view_set_zoom (LdDiagramView *self, gdouble zoom);
gboolean ld_diagram_view_can_zoom_in (LdDiagramView *self);
void ld_diagram_view_zoom_in (LdDiagramView *self);
gboolean ld_diagram_view_can_zoom_out (LdDiagramView *self);
void ld_diagram_view_zoom_out (LdDiagramView *self);
gboolean ld_diagram_view_get_show_grid (LdDiagramView *self);
void ld_diagram_view_set_show_grid (LdDiagramView *self, gboolean show_grid);
void ld_diagram_view_add_object_begin (LdDiagramView *self,
LdDiagramObject *object);
G_END_DECLS
#endif /* ! __LD_DIAGRAM_VIEW_H__ */

View File

@@ -15,7 +15,7 @@
/** /**
* SECTION:ld-diagram * SECTION:ld-diagram
* @short_description: A model for diagrams * @short_description: A model for diagrams
* @see_also: #LdCanvas * @see_also: #LdDiagramView
* *
* #LdDiagram is a model used for storing diagrams. * #LdDiagram is a model used for storing diagrams.
*/ */

View File

@@ -61,25 +61,25 @@ struct _SymbolMenuData
enum enum
{ {
CANVAS_HANDLER_EXPOSE, VIEW_HANDLER_EXPOSE,
CANVAS_HANDLER_MOTION_NOTIFY, VIEW_HANDLER_MOTION_NOTIFY,
CANVAS_HANDLER_BUTTON_PRESS, VIEW_HANDLER_BUTTON_PRESS,
CANVAS_HANDLER_BUTTON_RELEASE, VIEW_HANDLER_BUTTON_RELEASE,
CANVAS_HANDLER_COUNT VIEW_HANDLER_COUNT
}; };
/* /*
* LdLibraryToolbarPrivate: * LdLibraryToolbarPrivate:
* @library: a library object assigned to this canvas as a model. * @library: a library object assigned as a model.
* @canvas: a canvas object for showing symbol menus. * @view: a view widget for showing symbol menus.
* @canvas_handlers: signal handlers that hook the canvas. * @view_handlers: signal handlers that hook the view.
* @symbol_menu: data related to menus. * @symbol_menu: data related to menus.
*/ */
struct _LdLibraryToolbarPrivate struct _LdLibraryToolbarPrivate
{ {
LdLibrary *library; LdLibrary *library;
LdCanvas *canvas; LdDiagramView *view;
gulong canvas_handlers[CANVAS_HANDLER_COUNT]; gulong view_handlers[VIEW_HANDLER_COUNT];
SymbolMenuData symbol_menu; SymbolMenuData symbol_menu;
}; };
@@ -87,7 +87,7 @@ enum
{ {
PROP_0, PROP_0,
PROP_LIBRARY, PROP_LIBRARY,
PROP_CANVAS PROP_VIEW
}; };
static void ld_library_toolbar_get_property (GObject *object, guint property_id, static void ld_library_toolbar_get_property (GObject *object, guint property_id,
@@ -106,16 +106,16 @@ static void emit_symbol_signal (LdLibraryToolbar *self,
static void on_category_toggle (GtkToggleButton *toggle_button, static void on_category_toggle (GtkToggleButton *toggle_button,
gpointer user_data); gpointer user_data);
static inline void block_canvas_handlers (LdLibraryToolbar *self); static inline void block_view_handlers (LdLibraryToolbar *self);
static inline void unblock_canvas_handlers (LdLibraryToolbar *self); static inline void unblock_view_handlers (LdLibraryToolbar *self);
static inline void disconnect_canvas_handlers (LdLibraryToolbar *self); static inline void disconnect_view_handlers (LdLibraryToolbar *self);
static gboolean on_canvas_exposed (GtkWidget *widget, static gboolean on_view_exposed (GtkWidget *widget,
GdkEventExpose *event, gpointer user_data); GdkEventExpose *event, gpointer user_data);
static gboolean on_canvas_motion_notify (GtkWidget *widget, static gboolean on_view_motion_notify (GtkWidget *widget,
GdkEventMotion *event, gpointer user_data); GdkEventMotion *event, gpointer user_data);
static gboolean on_canvas_button_press (GtkWidget *widget, static gboolean on_view_button_press (GtkWidget *widget,
GdkEventButton *event, gpointer user_data); GdkEventButton *event, gpointer user_data);
static gboolean on_canvas_button_release (GtkWidget *widget, static gboolean on_view_button_release (GtkWidget *widget,
GdkEventButton *event, gpointer user_data); GdkEventButton *event, gpointer user_data);
@@ -138,22 +138,22 @@ ld_library_toolbar_class_init (LdLibraryToolbarClass *klass)
/** /**
* LdLibraryToolbar:library: * LdLibraryToolbar:library:
* *
* The #LdLibrary that this canvas retrieves symbols from. * The #LdLibrary that this toolbar retrieves symbols from.
*/ */
pspec = g_param_spec_object ("library", "Library", pspec = g_param_spec_object ("library", "Library",
"The library that this canvas retrieves symbols from.", "The library that this toolbar retrieves symbols from.",
LD_TYPE_LIBRARY, G_PARAM_READWRITE); LD_TYPE_LIBRARY, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_LIBRARY, pspec); g_object_class_install_property (object_class, PROP_LIBRARY, pspec);
/** /**
* LdLibraryToolbar:canvas: * LdLibraryToolbar:view:
* *
* The #LdCanvas misused for showing symbol menus. * The #LdDiagramView widget misused for showing symbol menus.
*/ */
pspec = g_param_spec_object ("canvas", "Canvas", pspec = g_param_spec_object ("view", "View",
"The canvas misused for showing symbol menus.", "The view widget misused for showing symbol menus.",
LD_TYPE_CANVAS, G_PARAM_READWRITE); LD_TYPE_DIAGRAM_VIEW, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_CANVAS, pspec); g_object_class_install_property (object_class, PROP_VIEW, pspec);
/** /**
* LdLibraryToolbar::symbol-chosen: * LdLibraryToolbar::symbol-chosen:
@@ -218,7 +218,7 @@ ld_library_toolbar_dispose (GObject *gobject)
self = LD_LIBRARY_TOOLBAR (gobject); self = LD_LIBRARY_TOOLBAR (gobject);
ld_library_toolbar_set_library (self, NULL); ld_library_toolbar_set_library (self, NULL);
ld_library_toolbar_set_canvas (self, NULL); ld_library_toolbar_set_view (self, NULL);
/* Chain up to the parent class. */ /* Chain up to the parent class. */
G_OBJECT_CLASS (ld_library_toolbar_parent_class)->dispose (gobject); G_OBJECT_CLASS (ld_library_toolbar_parent_class)->dispose (gobject);
@@ -236,8 +236,8 @@ ld_library_toolbar_get_property (GObject *object, guint property_id,
case PROP_LIBRARY: case PROP_LIBRARY:
g_value_set_object (value, ld_library_toolbar_get_library (self)); g_value_set_object (value, ld_library_toolbar_get_library (self));
break; break;
case PROP_CANVAS: case PROP_VIEW:
g_value_set_object (value, ld_library_toolbar_get_canvas (self)); g_value_set_object (value, ld_library_toolbar_get_view (self));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -257,9 +257,9 @@ ld_library_toolbar_set_property (GObject *object, guint property_id,
ld_library_toolbar_set_library (self, ld_library_toolbar_set_library (self,
LD_LIBRARY (g_value_get_object (value))); LD_LIBRARY (g_value_get_object (value)));
break; break;
case PROP_CANVAS: case PROP_VIEW:
ld_library_toolbar_set_canvas (self, ld_library_toolbar_set_view (self,
LD_CANVAS (g_value_get_object (value))); LD_DIAGRAM_VIEW (g_value_get_object (value)));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -281,7 +281,7 @@ ld_library_toolbar_new (void)
/** /**
* ld_library_toolbar_set_library: * ld_library_toolbar_set_library:
* @self: an #LdLibraryToolbar object. * @self: an #LdLibraryToolbar object.
* @library: (allow-none): the #LdLibrary to be assigned to the toolbar. * @library: (allow-none): the library to be assigned to the toolbar.
* *
* Assign an #LdLibrary object to the toolbar. * Assign an #LdLibrary object to the toolbar.
*/ */
@@ -315,8 +315,8 @@ ld_library_toolbar_set_library (LdLibraryToolbar *self, LdLibrary *library)
* ld_library_toolbar_get_library: * ld_library_toolbar_get_library:
* @self: an #LdLibraryToolbar object. * @self: an #LdLibraryToolbar object.
* *
* Get the #LdLibrary object assigned to this toolbar. * Return value: (transfer none): the #LdLibrary object
* The reference count on the library is not incremented. * assigned to the toolbar.
*/ */
LdLibrary * LdLibrary *
ld_library_toolbar_get_library (LdLibraryToolbar *self) ld_library_toolbar_get_library (LdLibraryToolbar *self)
@@ -326,59 +326,59 @@ ld_library_toolbar_get_library (LdLibraryToolbar *self)
} }
/** /**
* ld_library_toolbar_set_canvas: * ld_library_toolbar_set_view:
* @self: an #LdLibraryToolbar object. * @self: an #LdLibraryToolbar object.
* @canvas: (allow-none): the #LdCanvas to be assigned to the toolbar. * @view: (allow-none): the widget to be assigned to the toolbar.
* *
* Assign an #LdCanvas object to the toolbar. * Assign an #LdDiagramView widget to the toolbar.
*/ */
void void
ld_library_toolbar_set_canvas (LdLibraryToolbar *self, LdCanvas *canvas) ld_library_toolbar_set_view (LdLibraryToolbar *self, LdDiagramView *view)
{ {
g_return_if_fail (LD_IS_LIBRARY_TOOLBAR (self)); g_return_if_fail (LD_IS_LIBRARY_TOOLBAR (self));
g_return_if_fail (LD_IS_CANVAS (canvas) || canvas == NULL); g_return_if_fail (LD_IS_DIAGRAM_VIEW (view) || view == NULL);
if (self->priv->canvas) if (self->priv->view)
{ {
disconnect_canvas_handlers (self); disconnect_view_handlers (self);
g_object_unref (self->priv->canvas); g_object_unref (self->priv->view);
} }
self->priv->canvas = canvas; self->priv->view = view;
if (canvas) if (view)
{ {
self->priv->canvas_handlers[CANVAS_HANDLER_EXPOSE] self->priv->view_handlers[VIEW_HANDLER_EXPOSE]
= g_signal_connect (canvas, "expose-event", = g_signal_connect (view, "expose-event",
G_CALLBACK (on_canvas_exposed), self); G_CALLBACK (on_view_exposed), self);
self->priv->canvas_handlers[CANVAS_HANDLER_MOTION_NOTIFY] self->priv->view_handlers[VIEW_HANDLER_MOTION_NOTIFY]
= g_signal_connect (canvas, "motion-notify-event", = g_signal_connect (view, "motion-notify-event",
G_CALLBACK (on_canvas_motion_notify), self); G_CALLBACK (on_view_motion_notify), self);
self->priv->canvas_handlers[CANVAS_HANDLER_BUTTON_PRESS] self->priv->view_handlers[VIEW_HANDLER_BUTTON_PRESS]
= g_signal_connect (canvas, "button-press-event", = g_signal_connect (view, "button-press-event",
G_CALLBACK (on_canvas_button_press), self); G_CALLBACK (on_view_button_press), self);
self->priv->canvas_handlers[CANVAS_HANDLER_BUTTON_RELEASE] self->priv->view_handlers[VIEW_HANDLER_BUTTON_RELEASE]
= g_signal_connect (canvas, "button-release-event", = g_signal_connect (view, "button-release-event",
G_CALLBACK (on_canvas_button_release), self); G_CALLBACK (on_view_button_release), self);
block_canvas_handlers (self); block_view_handlers (self);
g_object_ref (canvas); g_object_ref (view);
} }
g_object_notify (G_OBJECT (self), "canvas"); g_object_notify (G_OBJECT (self), "view");
} }
/** /**
* ld_library_toolbar_get_canvas: * ld_library_toolbar_get_view:
* @self: an #LdLibraryToolbar object. * @self: an #LdLibraryToolbar object.
* *
* Get the #LdLibrary object assigned to this toolbar. * Return value: (transfer none): the #LdDiagramView widget
* The reference count on the canvas is not incremented. * assigned to the toolbar.
*/ */
LdCanvas * LdDiagramView *
ld_library_toolbar_get_canvas (LdLibraryToolbar *self) ld_library_toolbar_get_view (LdLibraryToolbar *self)
{ {
g_return_val_if_fail (LD_IS_LIBRARY_TOOLBAR (self), NULL); g_return_val_if_fail (LD_IS_LIBRARY_TOOLBAR (self), NULL);
return self->priv->canvas; return self->priv->view;
} }
static void static void
@@ -439,7 +439,7 @@ load_category_cb (gpointer data, gpointer user_data)
gtk_container_add (GTK_CONTAINER (button), img); gtk_container_add (GTK_CONTAINER (button), img);
gtk_container_add (GTK_CONTAINER (item), button); gtk_container_add (GTK_CONTAINER (item), button);
/* Don't steal focus from the canvas. */ /* Don't steal focus from the view. */
g_object_set (button, "can-focus", FALSE, NULL); g_object_set (button, "can-focus", FALSE, NULL);
/* Assign the category to the toggle button. */ /* Assign the category to the toggle button. */
@@ -498,7 +498,7 @@ redraw_symbol_menu (LdLibraryToolbar *self)
g_return_if_fail (LD_IS_LIBRARY_TOOLBAR (self)); g_return_if_fail (LD_IS_LIBRARY_TOOLBAR (self));
data = &self->priv->symbol_menu; data = &self->priv->symbol_menu;
gtk_widget_queue_draw_area (GTK_WIDGET (self->priv->canvas), gtk_widget_queue_draw_area (GTK_WIDGET (self->priv->view),
0, data->menu_y - 1, data->menu_width + 2, data->menu_height + 2); 0, data->menu_y - 1, data->menu_width + 2, data->menu_height + 2);
} }
@@ -541,7 +541,7 @@ on_category_toggle (GtkToggleButton *toggle_button, gpointer user_data)
{ {
gint i; gint i;
block_canvas_handlers (self); block_view_handlers (self);
g_object_unref (data->active_button); g_object_unref (data->active_button);
data->active_button = NULL; data->active_button = NULL;
@@ -559,7 +559,7 @@ on_category_toggle (GtkToggleButton *toggle_button, gpointer user_data)
g_free (data->items); g_free (data->items);
data->items = NULL; data->items = NULL;
gtk_grab_remove (GTK_WIDGET (self->priv->canvas)); gtk_grab_remove (GTK_WIDGET (self->priv->view));
} }
else else
{ {
@@ -568,12 +568,12 @@ on_category_toggle (GtkToggleButton *toggle_button, gpointer user_data)
gint x, y, menu_width; gint x, y, menu_width;
g_return_if_fail (gtk_widget_translate_coordinates (GTK_WIDGET g_return_if_fail (gtk_widget_translate_coordinates (GTK_WIDGET
(toggle_button), GTK_WIDGET (priv->canvas), 0, 0, &x, &y)); (toggle_button), GTK_WIDGET (priv->view), 0, 0, &x, &y));
data->menu_y = y; data->menu_y = y;
data->menu_height = GTK_WIDGET (toggle_button)->allocation.height; data->menu_height = GTK_WIDGET (toggle_button)->allocation.height;
unblock_canvas_handlers (self); unblock_view_handlers (self);
data->active_button = toggle_button; data->active_button = toggle_button;
g_object_ref (data->active_button); g_object_ref (data->active_button);
@@ -606,6 +606,8 @@ on_category_toggle (GtkToggleButton *toggle_button, gpointer user_data)
*/ */
item->scale = data->menu_height * 0.5 item->scale = data->menu_height * 0.5
/ MAX (ABS (area.y), ABS (area.y + area.height)) * 0.5; / MAX (ABS (area.y), ABS (area.y + area.height)) * 0.5;
if (item->scale * area.width > 1.5 * data->menu_height)
item->scale = 1.5 * data->menu_height / area.width;
item->width = data->menu_height * 0.5 + item->scale * area.width; item->width = data->menu_height * 0.5 + item->scale * area.width;
item->dx = item->width * 0.5 + item->scale item->dx = item->width * 0.5 + item->scale
* (area.width * 0.5 - ABS (area.x + area.width)); * (area.width * 0.5 - ABS (area.x + area.width));
@@ -614,28 +616,28 @@ on_category_toggle (GtkToggleButton *toggle_button, gpointer user_data)
} }
data->menu_width = menu_width; data->menu_width = menu_width;
gtk_grab_add (GTK_WIDGET (self->priv->canvas)); gtk_grab_add (GTK_WIDGET (self->priv->view));
} }
redraw_symbol_menu (self); redraw_symbol_menu (self);
} }
#define DEFINE_CANVAS_HANDLER_FUNC(name) \ #define DEFINE_VIEW_HANDLER_FUNC(name) \
static inline void \ static inline void \
name ## _canvas_handlers (LdLibraryToolbar *self) \ name ## _view_handlers (LdLibraryToolbar *self) \
{ \ { \
gint i; \ gint i; \
g_return_if_fail (LD_IS_CANVAS (self->priv->canvas)); \ g_return_if_fail (LD_IS_DIAGRAM_VIEW (self->priv->view)); \
for (i = 0; i < CANVAS_HANDLER_COUNT; i++) \ for (i = 0; i < VIEW_HANDLER_COUNT; i++) \
g_signal_handler_ ## name (self->priv->canvas, \ g_signal_handler_ ## name (self->priv->view, \
self->priv->canvas_handlers[i]); \ self->priv->view_handlers[i]); \
} }
DEFINE_CANVAS_HANDLER_FUNC (block) DEFINE_VIEW_HANDLER_FUNC (block)
DEFINE_CANVAS_HANDLER_FUNC (unblock) DEFINE_VIEW_HANDLER_FUNC (unblock)
DEFINE_CANVAS_HANDLER_FUNC (disconnect) DEFINE_VIEW_HANDLER_FUNC (disconnect)
static gboolean static gboolean
on_canvas_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) on_view_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
{ {
cairo_t *cr; cairo_t *cr;
LdLibraryToolbar *self; LdLibraryToolbar *self;
@@ -658,6 +660,14 @@ on_canvas_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
{ {
SymbolMenuItem *item; SymbolMenuItem *item;
if (i)
{
cairo_move_to (cr, x - 0.5, data->menu_y + 1);
cairo_line_to (cr, x - 0.5, data->menu_y + data->menu_height);
cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
cairo_stroke (cr);
}
item = data->items + i; item = data->items + i;
cairo_save (cr); cairo_save (cr);
@@ -682,7 +692,8 @@ on_canvas_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
x += item->width; x += item->width;
} }
cairo_rectangle (cr, 0, data->menu_y, data->menu_width, data->menu_height); cairo_rectangle (cr, 0.5, data->menu_y + 0.5,
data->menu_width, data->menu_height);
cairo_set_source_rgb (cr, 0, 0, 0); cairo_set_source_rgb (cr, 0, 0, 0);
cairo_stroke (cr); cairo_stroke (cr);
@@ -691,7 +702,7 @@ on_canvas_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
} }
static gboolean static gboolean
on_canvas_motion_notify (GtkWidget *widget, GdkEventMotion *event, on_view_motion_notify (GtkWidget *widget, GdkEventMotion *event,
gpointer user_data) gpointer user_data)
{ {
LdLibraryToolbar *self; LdLibraryToolbar *self;
@@ -704,7 +715,7 @@ on_canvas_motion_notify (GtkWidget *widget, GdkEventMotion *event,
if (widget->window != event->window if (widget->window != event->window
|| event->x < 0 || event->y < data->menu_y || event->x < 0 || event->y < data->menu_y
|| event->y >= data->menu_y + data->menu_height) || event->y >= data->menu_y + data->menu_height)
goto on_canvas_motion_notify_end; goto on_view_motion_notify_end;
for (x = i = 0; i < data->n_items; i++) for (x = i = 0; i < data->n_items; i++)
{ {
@@ -716,7 +727,7 @@ on_canvas_motion_notify (GtkWidget *widget, GdkEventMotion *event,
} }
} }
on_canvas_motion_notify_end: on_view_motion_notify_end:
if (data->active_item != at_cursor) if (data->active_item != at_cursor)
{ {
emit_symbol_signal (self, LD_LIBRARY_TOOLBAR_GET_CLASS (self) emit_symbol_signal (self, LD_LIBRARY_TOOLBAR_GET_CLASS (self)
@@ -732,7 +743,7 @@ on_canvas_motion_notify_end:
} }
static gboolean static gboolean
on_canvas_button_press (GtkWidget *widget, GdkEventButton *event, on_view_button_press (GtkWidget *widget, GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
LdLibraryToolbar *self; LdLibraryToolbar *self;
@@ -753,7 +764,7 @@ on_canvas_button_press (GtkWidget *widget, GdkEventButton *event,
} }
static gboolean static gboolean
on_canvas_button_release (GtkWidget *widget, GdkEventButton *event, on_view_button_release (GtkWidget *widget, GdkEventButton *event,
gpointer user_data) gpointer user_data)
{ {
LdLibraryToolbar *self; LdLibraryToolbar *self;

View File

@@ -59,9 +59,9 @@ GtkWidget *ld_library_toolbar_new (void);
void ld_library_toolbar_set_library (LdLibraryToolbar *self, void ld_library_toolbar_set_library (LdLibraryToolbar *self,
LdLibrary *library); LdLibrary *library);
LdLibrary *ld_library_toolbar_get_library (LdLibraryToolbar *self); LdLibrary *ld_library_toolbar_get_library (LdLibraryToolbar *self);
void ld_library_toolbar_set_canvas (LdLibraryToolbar *self, void ld_library_toolbar_set_view (LdLibraryToolbar *self,
LdCanvas *canvas); LdDiagramView *view);
LdCanvas *ld_library_toolbar_get_canvas (LdLibraryToolbar *self); LdDiagramView *ld_library_toolbar_get_view (LdLibraryToolbar *self);
G_END_DECLS G_END_DECLS

View File

@@ -94,6 +94,9 @@ static int ld_lua_cairo_save (lua_State *L);
static int ld_lua_cairo_restore (lua_State *L); static int ld_lua_cairo_restore (lua_State *L);
static int ld_lua_cairo_get_line_width (lua_State *L); static int ld_lua_cairo_get_line_width (lua_State *L);
static int ld_lua_cairo_set_line_width (lua_State *L); static int ld_lua_cairo_set_line_width (lua_State *L);
static int ld_lua_cairo_translate (lua_State *L);
static int ld_lua_cairo_scale (lua_State *L);
static int ld_lua_cairo_rotate (lua_State *L);
static int ld_lua_cairo_move_to (lua_State *L); static int ld_lua_cairo_move_to (lua_State *L);
static int ld_lua_cairo_line_to (lua_State *L); static int ld_lua_cairo_line_to (lua_State *L);
static int ld_lua_cairo_curve_to (lua_State *L); static int ld_lua_cairo_curve_to (lua_State *L);
@@ -108,6 +111,7 @@ static int ld_lua_cairo_fill (lua_State *L);
static int ld_lua_cairo_fill_preserve (lua_State *L); static int ld_lua_cairo_fill_preserve (lua_State *L);
static int ld_lua_cairo_clip (lua_State *L); static int ld_lua_cairo_clip (lua_State *L);
static int ld_lua_cairo_clip_preserve (lua_State *L); static int ld_lua_cairo_clip_preserve (lua_State *L);
static int ld_lua_cairo_show_text (lua_State *L);
static luaL_Reg ld_lua_logdiag_lib[] = static luaL_Reg ld_lua_logdiag_lib[] =
@@ -122,6 +126,9 @@ static luaL_Reg ld_lua_cairo_table[] =
{"restore", ld_lua_cairo_restore}, {"restore", ld_lua_cairo_restore},
{"get_line_width", ld_lua_cairo_get_line_width}, {"get_line_width", ld_lua_cairo_get_line_width},
{"set_line_width", ld_lua_cairo_set_line_width}, {"set_line_width", ld_lua_cairo_set_line_width},
{"translate", ld_lua_cairo_translate},
{"scale", ld_lua_cairo_scale},
{"rotate", ld_lua_cairo_rotate},
{"move_to", ld_lua_cairo_move_to}, {"move_to", ld_lua_cairo_move_to},
{"line_to", ld_lua_cairo_line_to}, {"line_to", ld_lua_cairo_line_to},
{"curve_to", ld_lua_cairo_curve_to}, {"curve_to", ld_lua_cairo_curve_to},
@@ -136,6 +143,7 @@ static luaL_Reg ld_lua_cairo_table[] =
{"fill_preserve", ld_lua_cairo_fill_preserve}, {"fill_preserve", ld_lua_cairo_fill_preserve},
{"clip", ld_lua_cairo_clip}, {"clip", ld_lua_cairo_clip},
{"clip_preserve", ld_lua_cairo_clip_preserve}, {"clip_preserve", ld_lua_cairo_clip_preserve},
{"show_text", ld_lua_cairo_show_text},
{NULL, NULL} {NULL, NULL}
}; };
@@ -649,15 +657,21 @@ get_cairo_scale (cairo_t *cr)
return dx; return dx;
} }
#define LD_LUA_CAIRO_TRIVIAL(name) \ #define LD_LUA_CAIRO_BEGIN(name) \
static int \ static int \
ld_lua_cairo_ ## name (lua_State *L) \ ld_lua_cairo_ ## name (lua_State *L) \
{ \ { \
LdLuaDrawData *data; \ LdLuaDrawData *data; \
#define LD_LUA_CAIRO_END(n_values) \
return (n_values); \
}
#define LD_LUA_CAIRO_TRIVIAL(name) \
LD_LUA_CAIRO_BEGIN (name) \
data = lua_touserdata (L, lua_upvalueindex (1)); \ data = lua_touserdata (L, lua_upvalueindex (1)); \
cairo_ ## name (data->cr); \ cairo_ ## name (data->cr); \
return 0; \ LD_LUA_CAIRO_END (0)
}
LD_LUA_CAIRO_TRIVIAL (new_path) LD_LUA_CAIRO_TRIVIAL (new_path)
LD_LUA_CAIRO_TRIVIAL (new_sub_path) LD_LUA_CAIRO_TRIVIAL (new_sub_path)
@@ -670,60 +684,67 @@ LD_LUA_CAIRO_TRIVIAL (fill_preserve)
LD_LUA_CAIRO_TRIVIAL (clip) LD_LUA_CAIRO_TRIVIAL (clip)
LD_LUA_CAIRO_TRIVIAL (clip_preserve) LD_LUA_CAIRO_TRIVIAL (clip_preserve)
static int LD_LUA_CAIRO_BEGIN (save)
ld_lua_cairo_save (lua_State *L)
{
LdLuaDrawData *data;
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
if (data->save_count + 1) if (data->save_count + 1)
{ {
data->save_count++; data->save_count++;
cairo_save (data->cr); cairo_save (data->cr);
} }
return 0; LD_LUA_CAIRO_END (0)
}
static int
ld_lua_cairo_restore (lua_State *L)
{
LdLuaDrawData *data;
LD_LUA_CAIRO_BEGIN (restore)
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
if (data->save_count) if (data->save_count)
{ {
data->save_count--; data->save_count--;
cairo_restore (data->cr); cairo_restore (data->cr);
} }
return 0; LD_LUA_CAIRO_END (0)
}
static int
ld_lua_cairo_get_line_width (lua_State *L)
{
LdLuaDrawData *data;
LD_LUA_CAIRO_BEGIN (get_line_width)
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
lua_pushnumber (L, cairo_get_line_width (data->cr) lua_pushnumber (L, cairo_get_line_width (data->cr)
* get_cairo_scale (data->cr)); * get_cairo_scale (data->cr));
return 1; LD_LUA_CAIRO_END (1)
}
static int
ld_lua_cairo_set_line_width (lua_State *L)
{
LdLuaDrawData *data;
LD_LUA_CAIRO_BEGIN (set_line_width)
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
cairo_set_line_width (data->cr, luaL_checknumber (L, 1) cairo_set_line_width (data->cr, luaL_checknumber (L, 1)
/ get_cairo_scale (data->cr)); / get_cairo_scale (data->cr));
return 0; LD_LUA_CAIRO_END (0)
}
static int LD_LUA_CAIRO_BEGIN (translate)
ld_lua_cairo_move_to (lua_State *L) lua_Number x, y;
{
LdLuaDrawData *data; data = lua_touserdata (L, lua_upvalueindex (1));
x = luaL_checknumber (L, 1);
y = luaL_checknumber (L, 2);
cairo_translate (data->cr, x, y);
LD_LUA_CAIRO_END (0)
LD_LUA_CAIRO_BEGIN (scale)
lua_Number sx, sy;
data = lua_touserdata (L, lua_upvalueindex (1));
sx = luaL_checknumber (L, 1);
sy = luaL_checknumber (L, 2);
cairo_scale (data->cr, sx, sy);
LD_LUA_CAIRO_END (0)
LD_LUA_CAIRO_BEGIN (rotate)
lua_Number angle;
data = lua_touserdata (L, lua_upvalueindex (1));
angle = luaL_checknumber (L, 1);
cairo_rotate (data->cr, angle);
LD_LUA_CAIRO_END (0)
LD_LUA_CAIRO_BEGIN (move_to)
lua_Number x, y; lua_Number x, y;
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
@@ -732,13 +753,9 @@ ld_lua_cairo_move_to (lua_State *L)
y = luaL_checknumber (L, 2); y = luaL_checknumber (L, 2);
cairo_move_to (data->cr, x, y); cairo_move_to (data->cr, x, y);
return 0; LD_LUA_CAIRO_END (0)
}
static int LD_LUA_CAIRO_BEGIN (line_to)
ld_lua_cairo_line_to (lua_State *L)
{
LdLuaDrawData *data;
lua_Number x, y; lua_Number x, y;
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
@@ -747,13 +764,9 @@ ld_lua_cairo_line_to (lua_State *L)
y = luaL_checknumber (L, 2); y = luaL_checknumber (L, 2);
cairo_line_to (data->cr, x, y); cairo_line_to (data->cr, x, y);
return 0; LD_LUA_CAIRO_END (0)
}
static int LD_LUA_CAIRO_BEGIN (curve_to)
ld_lua_cairo_curve_to (lua_State *L)
{
LdLuaDrawData *data;
lua_Number x1, y1, x2, y2, x3, y3; lua_Number x1, y1, x2, y2, x3, y3;
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
@@ -766,13 +779,9 @@ ld_lua_cairo_curve_to (lua_State *L)
y3 = luaL_checknumber (L, 6); y3 = luaL_checknumber (L, 6);
cairo_curve_to (data->cr, x1, y1, x2, y2, x3, y3); cairo_curve_to (data->cr, x1, y1, x2, y2, x3, y3);
return 0; LD_LUA_CAIRO_END (0)
}
static int LD_LUA_CAIRO_BEGIN (arc)
ld_lua_cairo_arc (lua_State *L)
{
LdLuaDrawData *data;
lua_Number xc, yc, radius, angle1, angle2; lua_Number xc, yc, radius, angle1, angle2;
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
@@ -784,13 +793,9 @@ ld_lua_cairo_arc (lua_State *L)
angle2 = luaL_checknumber (L, 5); angle2 = luaL_checknumber (L, 5);
cairo_arc (data->cr, xc, yc, radius, angle1, angle2); cairo_arc (data->cr, xc, yc, radius, angle1, angle2);
return 0; LD_LUA_CAIRO_END (0)
}
static int LD_LUA_CAIRO_BEGIN (arc_negative)
ld_lua_cairo_arc_negative (lua_State *L)
{
LdLuaDrawData *data;
lua_Number xc, yc, radius, angle1, angle2; lua_Number xc, yc, radius, angle1, angle2;
data = lua_touserdata (L, lua_upvalueindex (1)); data = lua_touserdata (L, lua_upvalueindex (1));
@@ -802,6 +807,36 @@ ld_lua_cairo_arc_negative (lua_State *L)
angle2 = luaL_checknumber (L, 5); angle2 = luaL_checknumber (L, 5);
cairo_arc_negative (data->cr, xc, yc, radius, angle1, angle2); cairo_arc_negative (data->cr, xc, yc, radius, angle1, angle2);
return 0; LD_LUA_CAIRO_END (0)
}
LD_LUA_CAIRO_BEGIN (show_text)
const char *text;
GtkStyle *style;
PangoLayout *layout;
int width, height;
double x, y;
data = lua_touserdata (L, lua_upvalueindex (1));
text = luaL_checkstring (L, 1);
layout = pango_cairo_create_layout (data->cr);
pango_layout_set_text (layout, text, -1);
style = gtk_style_new ();
pango_font_description_set_size (style->font_desc, 1 * PANGO_SCALE);
pango_layout_set_font_description (layout, style->font_desc);
g_object_unref (style);
pango_layout_get_size (layout, &width, &height);
cairo_get_current_point (data->cr, &x, &y);
x -= (double) width / PANGO_SCALE / 2;
y -= (double) height / PANGO_SCALE / 2;
cairo_save (data->cr);
cairo_move_to (data->cr, x, y);
pango_cairo_show_layout (data->cr, layout);
cairo_restore (data->cr);
g_object_unref (layout);
LD_LUA_CAIRO_END (0)

View File

@@ -15,9 +15,9 @@
/** /**
* SECTION:ld-symbol * SECTION:ld-symbol
* @short_description: A symbol * @short_description: A symbol
* @see_also: #LdDiagramSymbol, #LdCanvas * @see_also: #LdDiagramSymbol, #LdDiagramView
* *
* #LdSymbol represents a symbol to be drawn onto a #LdCanvas. * #LdSymbol represents a symbol to be drawn by #LdDiagramView.
* *
* All implementations of this abstract class are required to use * All implementations of this abstract class are required to use
* cairo_save() and cairo_restore() when drawing to store the state. * cairo_save() and cairo_restore() when drawing to store the state.

View File

@@ -18,10 +18,6 @@ G_BEGIN_DECLS
#define LD_TYPE_POINT_ARRAY (ld_point_array_get_type ()) #define LD_TYPE_POINT_ARRAY (ld_point_array_get_type ())
#define LD_TYPE_RECTANGLE (ld_rectangle_get_type ()) #define LD_TYPE_RECTANGLE (ld_rectangle_get_type ())
typedef struct _LdPoint LdPoint;
typedef struct _LdPointArray LdPointArray;
typedef struct _LdRectangle LdRectangle;
/** /**
* LdPoint: * LdPoint:
@@ -30,10 +26,11 @@ typedef struct _LdRectangle LdRectangle;
* *
* Defines a point. * Defines a point.
*/ */
struct _LdPoint typedef struct
{ {
gdouble x, y; gdouble x, y;
}; }
LdPoint;
GType ld_point_get_type (void) G_GNUC_CONST; GType ld_point_get_type (void) G_GNUC_CONST;
@@ -50,12 +47,13 @@ gdouble ld_point_distance (const LdPoint *self, gdouble x, gdouble y);
* *
* Defines an array of points. * Defines an array of points.
*/ */
struct _LdPointArray typedef struct
{ {
LdPoint *points; LdPoint *points;
guint length; guint length;
guint size; guint size;
}; }
LdPointArray;
GType ld_point_array_get_type (void) G_GNUC_CONST; GType ld_point_array_get_type (void) G_GNUC_CONST;
@@ -78,11 +76,12 @@ void ld_point_array_set_size (LdPointArray *self, guint size);
* *
* Defines a rectangle. * Defines a rectangle.
*/ */
struct _LdRectangle typedef struct
{ {
gdouble x, y; gdouble x, y;
gdouble width, height; gdouble width, height;
}; }
LdRectangle;
GType ld_rectangle_get_type (void) G_GNUC_CONST; GType ld_rectangle_get_type (void) G_GNUC_CONST;

View File

@@ -27,7 +27,7 @@
#include "ld-diagram-connection.h" #include "ld-diagram-connection.h"
#include "ld-diagram.h" #include "ld-diagram.h"
#include "ld-canvas.h" #include "ld-diagram-view.h"
#include "ld-library-toolbar.h" #include "ld-library-toolbar.h"
#include "ld-lua.h" #include "ld-lua.h"

226
po/cs.po Normal file
View File

@@ -0,0 +1,226 @@
# Czech translation for logdiag.
# Copyright (C) 2011 Přemysl Janouch
# This file is distributed under the same license as the logdiag package.
# Přemysl Janouch <p.janouch@gmail.com>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
"PO-Revision-Date: 2011-03-06 16:24+0100\n"
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
"Language-Team: Czech <cs@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/ld-window-main.c:769
msgid "Close _without Saving"
msgstr "Zavřít _bez uložení"
#: ../src/ld-window-main.c:122
msgid "Create a new diagram"
msgstr "Vytvoří nový diagram"
#: ../src/ld-window-main.c:155
msgid "Delete the contents of the selection"
msgstr "Odstraní obsah výběru"
#: ../src/ld-window-main.c:637
msgid "Failed to open the file"
msgstr "Nelze otevřít soubor"
#: ../src/ld-window-main.c:602
msgid "Failed to save the diagram"
msgstr "Nelze uložit diagram"
#: ../src/ld-window-main.c:767
msgid "If you don't save, changes will be permanently lost."
msgstr "Pokud je neuložíte, budou změny navždy ztraceny."
#: ../src/ld-window-main.c:662
msgid "Logdiag Diagrams (*.ldd)"
msgstr "Diagramy logdiag (*.ldd)"
#: ../src/ld-window-main.c:125
msgid "Open a diagram"
msgstr "Otevře diagram"
#: ../src/ld-window-main.c:683
msgid "Open..."
msgstr "Otevřít..."
#: ../src/ld-window-main.c:139
msgid "Quit the application"
msgstr "Ukončí aplikaci"
#: ../src/ld-window-main.c:147
msgid "Redo the last undone action"
msgstr "Provede posledně vrácenou akci"
#: ../src/ld-window-main.c:169
msgid "Reset zoom level back to the default"
msgstr "Vrátí přiblížení na výchozí hodnotu"
#: ../src/ld-window-main.c:714
msgid "Save As..."
msgstr "Uložit jako..."
#: ../src/ld-window-main.c:130
msgid "Save _As..."
msgstr "Uložit _jako..."
#: ../src/ld-window-main.c:557
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and creating a new one?"
msgstr "Uložit změny v diagramu \"%s\" před jeho zavřením a vytvořením nového?"
#: ../src/ld-window-main.c:679
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and opening another one?"
msgstr "Uložit změny v diagramu \"%s\" před jeho zavřením a otevřením jiného?"
#: ../src/ld-window-main.c:807
#, c-format
msgid "Save the changes to diagram \"%s\" before closing?"
msgstr "Uložit změny v diagramu \"%s\" před jeho zavřením?"
#: ../src/ld-window-main.c:128
msgid "Save the current diagram"
msgstr "Uloží stávající diagram"
#: ../src/ld-window-main.c:131
msgid "Save the current diagram with another name"
msgstr "Uloží stávající diagram pod jiným jménem"
#: ../src/ld-window-main.c:157
msgid "Select _All"
msgstr "Vybrat _vše"
#: ../src/ld-window-main.c:158
msgid "Select all objects in the diagram"
msgstr "Vybere všechny objekty v diagramu"
#: ../src/ld-window-main.c:186
msgid "Show _Grid"
msgstr "Zobrazit _mřížku"
#: ../src/ld-window-main.c:174
msgid "Show a dialog about this application"
msgstr "Zobrazí dialog o této aplikaci"
#: ../src/ld-window-main.c:640
msgid "The file is probably corrupted."
msgstr "Soubor je pravděpodobně poškozen."
#: ../src/ld-window-main.c:187
msgid "Toggle displaying of the grid"
msgstr "Přepne zobrazování mřížky"
#: ../src/ld-window-main.c:184
msgid "Toggle displaying of the library toolbar"
msgstr "Přepne zobrazování panelu knihovny"
#: ../src/ld-window-main.c:181
msgid "Toggle displaying of the main toolbar"
msgstr "Přepne zobrazování hlavního panelu nástrojů"
#: ../src/ld-window-main.c:605
msgid "Try again or save it under another name."
msgstr "Zkuste to znova nebo jej uložte pod jiným názvem."
#: ../src/ld-window-main.c:144
msgid "Undo the last action"
msgstr "Vrátí poslední akci"
#: ../src/ld-window-main.c:525
msgid "Unsaved Diagram"
msgstr "Neuložený diagram"
#: ../src/ld-window-main.c:165
msgid "Zoom _Out"
msgstr "_Oddálit"
#: ../src/ld-window-main.c:163
msgid "Zoom into the diagram"
msgstr "Přiblíží diagram"
#: ../src/ld-window-main.c:166
msgid "Zoom out of the diagram"
msgstr "Oddálí diagram"
#: ../src/logdiag.c:42
msgid "[FILE] - Schematic editor"
msgstr "[SOUBOR] - Editor schémat"
#: ../src/ld-window-main.c:173
msgid "_About"
msgstr "_O programu"
#: ../src/ld-window-main.c:154
msgid "_Delete"
msgstr "_Smazat"
#: ../src/ld-window-main.c:142
msgid "_Edit"
msgstr "_Úpravy"
#: ../src/ld-window-main.c:120
msgid "_File"
msgstr "_Soubor"
#: ../src/ld-window-main.c:172
msgid "_Help"
msgstr "_Nápověda"
#: ../src/ld-window-main.c:183
msgid "_Library Toolbar"
msgstr "Panel _knihovny"
#: ../src/ld-window-main.c:180
msgid "_Main Toolbar"
msgstr "_Hlavní panel nástrojů"
#: ../src/ld-window-main.c:121
msgid "_New"
msgstr "_Nový"
#: ../src/ld-window-main.c:168
msgid "_Normal Size"
msgstr "_Normální velikost"
#: ../src/ld-window-main.c:124
msgid "_Open..."
msgstr "_Otevřít..."
#: ../src/ld-window-main.c:138
msgid "_Quit"
msgstr "U_končit"
#: ../src/ld-window-main.c:146
msgid "_Redo"
msgstr "Z_novu"
#: ../src/ld-window-main.c:127
msgid "_Save"
msgstr "_Uložit"
#: ../src/ld-window-main.c:143
msgid "_Undo"
msgstr "_Zpět"
#: ../src/ld-window-main.c:161
msgid "_View"
msgstr "_Zobrazení"
#: ../src/ld-window-main.c:162
msgid "_Zoom In"
msgstr "_Přiblížit"
#: ../src/ld-window-main.c:894
msgid "translator-credits"
msgstr "Přemysl Janouch <p.janouch@gmail.com>"

225
po/de.po Normal file
View File

@@ -0,0 +1,225 @@
# German translation for logdiag.
# Copyright (C) 2011 Přemysl Janouch
# This file is distributed under the same license as the logdiag package.
# Andy J., 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
"PO-Revision-Date: 2011-03-07 05:55+0100\n"
"Last-Translator: Andy J.\n"
"Language-Team: German <de@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/ld-window-main.c:120
msgid "_File"
msgstr "_Datei"
#: ../src/ld-window-main.c:121
msgid "_New"
msgstr "_Neu"
#: ../src/ld-window-main.c:122
msgid "Create a new diagram"
msgstr "Neues Diagramm erstellen"
#: ../src/ld-window-main.c:124
msgid "_Open..."
msgstr "_Öffnen..."
#: ../src/ld-window-main.c:125
msgid "Open a diagram"
msgstr "Diagramm öffnen"
#: ../src/ld-window-main.c:127
msgid "_Save"
msgstr "_Speichern"
#: ../src/ld-window-main.c:128
msgid "Save the current diagram"
msgstr "Speichern des aktuellen Diagramms"
#: ../src/ld-window-main.c:130
msgid "Save _As..."
msgstr "Speichern _unter..."
#: ../src/ld-window-main.c:131
msgid "Save the current diagram with another name"
msgstr "Aktuelles Diagramm unter anderem Namen speichern"
#: ../src/ld-window-main.c:138
msgid "_Quit"
msgstr "_Beenden"
#: ../src/ld-window-main.c:139
msgid "Quit the application"
msgstr "Anwendung beenden"
#: ../src/ld-window-main.c:142
msgid "_Edit"
msgstr "_Ändern"
#: ../src/ld-window-main.c:143
msgid "_Undo"
msgstr "_Rückgängig"
#: ../src/ld-window-main.c:144
msgid "Undo the last action"
msgstr "Letzte Aktion rückgangig machen"
#: ../src/ld-window-main.c:146
msgid "_Redo"
msgstr "_Wiederholen"
#: ../src/ld-window-main.c:147
msgid "Redo the last undone action"
msgstr "Letzte nicht abgeschlossene Aktion wiederholen"
#: ../src/ld-window-main.c:154
msgid "_Delete"
msgstr "_Löschen"
#: ../src/ld-window-main.c:155
msgid "Delete the contents of the selection"
msgstr "Inhalt der markierten Einträge löschen"
#: ../src/ld-window-main.c:157
msgid "Select _All"
msgstr "_Alles Auswählen"
#: ../src/ld-window-main.c:158
msgid "Select all objects in the diagram"
msgstr "Alle Objekte im Diagramm auswählen"
#: ../src/ld-window-main.c:161
msgid "_View"
msgstr "_Ansicht"
#: ../src/ld-window-main.c:162
msgid "_Zoom In"
msgstr "_Hineinzoomen"
#: ../src/ld-window-main.c:163
msgid "Zoom into the diagram"
msgstr "In das Diagramm zoomen"
#: ../src/ld-window-main.c:165
msgid "Zoom _Out"
msgstr "Zoom _heraus"
#: ../src/ld-window-main.c:166
msgid "Zoom out of the diagram"
msgstr "Aus dem Diagramm zoomen"
#: ../src/ld-window-main.c:168
msgid "_Normal Size"
msgstr "_Normale Größe"
#: ../src/ld-window-main.c:169
msgid "Reset zoom level back to the default"
msgstr "Zoom Bereich zurücksetzen"
#: ../src/ld-window-main.c:172
msgid "_Help"
msgstr "_Hilfe"
#: ../src/ld-window-main.c:173
msgid "_About"
msgstr "_Über"
#: ../src/ld-window-main.c:174
msgid "Show a dialog about this application"
msgstr "Zeige einen Dialog über diese Anwendung"
#: ../src/ld-window-main.c:180
msgid "_Main Toolbar"
msgstr "_Symbolleiste"
#: ../src/ld-window-main.c:181
msgid "Toggle displaying of the main toolbar"
msgstr "Symbolleiste ein-/ausblenden"
#: ../src/ld-window-main.c:183
msgid "_Library Toolbar"
msgstr "_Bibliothek Menüleiste"
#: ../src/ld-window-main.c:184
msgid "Toggle displaying of the library toolbar"
msgstr "Bibliothek ein-/ausblenden"
#: ../src/ld-window-main.c:186
msgid "Show _Grid"
msgstr "_Gitter anzeigen"
#: ../src/ld-window-main.c:187
msgid "Toggle displaying of the grid"
msgstr "Gitter ein-/ausblenden"
#: ../src/ld-window-main.c:525
msgid "Unsaved Diagram"
msgstr "Ungespeichertes Diagramm"
#: ../src/ld-window-main.c:557
#, c-format
msgid "Save the changes to diagram \"%s\" before closing it and creating a new one?"
msgstr "Änderungen im Diagramm \"%s\" speichern bevor ein Neues geöffnet wird?"
#: ../src/ld-window-main.c:602
msgid "Failed to save the diagram"
msgstr "Fehler beim Speichern des Diagramms"
#: ../src/ld-window-main.c:605
msgid "Try again or save it under another name."
msgstr "Erneuter Versuch oder unter anderem Namen speichern."
#: ../src/ld-window-main.c:637
msgid "Failed to open the file"
msgstr "Fehler beim Öffnen der Datei"
#: ../src/ld-window-main.c:640
msgid "The file is probably corrupted."
msgstr "Die Datei ist vermutlich beschädigt."
#: ../src/ld-window-main.c:662
msgid "Logdiag Diagrams (*.ldd)"
msgstr "Diagramme logdiag (.ldd)"
#: ../src/ld-window-main.c:679
#, c-format
msgid "Save the changes to diagram \"%s\" before closing it and opening another one?"
msgstr "Änderungen im Diagramm \"%s\" speichern bevor es beendet und ein Weiteres geöffnet wird?"
#: ../src/ld-window-main.c:683
msgid "Open..."
msgstr "Öffnen..."
#: ../src/ld-window-main.c:714
msgid "Save As..."
msgstr "Speichern unter..."
#: ../src/ld-window-main.c:767
msgid "If you don't save, changes will be permanently lost."
msgstr "Wenn Sie nicht speichern, gehen alle Änderungen verloren."
#: ../src/ld-window-main.c:769
msgid "Close _without Saving"
msgstr "Schließen _ohne Speichern"
#: ../src/ld-window-main.c:807
#, c-format
msgid "Save the changes to diagram \"%s\" before closing?"
msgstr "Änderungen im Diagramm \"%s\" vor dem Schließen speichern?"
#: ../src/ld-window-main.c:894
msgid "translator-credits"
msgstr "Andy J."
#: ../src/logdiag.c:42
msgid "[FILE] - Schematic editor"
msgstr "[DATEI] - Schema Editor"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: logdiag \n" "Project-Id-Version: logdiag \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-07-05 23:23+0200\n" "POT-Creation-Date: 2011-03-06 16:14+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,211 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/window-main.c:102 #: ../src/ld-window-main.c:120
#, c-format msgid "_File"
msgid "Building UI failed: %s" msgstr ""
#: ../src/ld-window-main.c:121
msgid "_New"
msgstr ""
#: ../src/ld-window-main.c:122
msgid "Create a new diagram"
msgstr ""
#: ../src/ld-window-main.c:124
msgid "_Open..."
msgstr ""
#: ../src/ld-window-main.c:125
msgid "Open a diagram"
msgstr ""
#: ../src/ld-window-main.c:127
msgid "_Save"
msgstr ""
#: ../src/ld-window-main.c:128
msgid "Save the current diagram"
msgstr ""
#: ../src/ld-window-main.c:130
msgid "Save _As..."
msgstr ""
#: ../src/ld-window-main.c:131
msgid "Save the current diagram with another name"
msgstr ""
#: ../src/ld-window-main.c:138
msgid "_Quit"
msgstr ""
#: ../src/ld-window-main.c:139
msgid "Quit the application"
msgstr ""
#: ../src/ld-window-main.c:142
msgid "_Edit"
msgstr ""
#: ../src/ld-window-main.c:143
msgid "_Undo"
msgstr ""
#: ../src/ld-window-main.c:144
msgid "Undo the last action"
msgstr ""
#: ../src/ld-window-main.c:146
msgid "_Redo"
msgstr ""
#: ../src/ld-window-main.c:147
msgid "Redo the last undone action"
msgstr ""
#: ../src/ld-window-main.c:154
msgid "_Delete"
msgstr ""
#: ../src/ld-window-main.c:155
msgid "Delete the contents of the selection"
msgstr ""
#: ../src/ld-window-main.c:157
msgid "Select _All"
msgstr ""
#: ../src/ld-window-main.c:158
msgid "Select all objects in the diagram"
msgstr ""
#: ../src/ld-window-main.c:161
msgid "_View"
msgstr ""
#: ../src/ld-window-main.c:162
msgid "_Zoom In"
msgstr ""
#: ../src/ld-window-main.c:163
msgid "Zoom into the diagram"
msgstr ""
#: ../src/ld-window-main.c:165
msgid "Zoom _Out"
msgstr ""
#: ../src/ld-window-main.c:166
msgid "Zoom out of the diagram"
msgstr ""
#: ../src/ld-window-main.c:168
msgid "_Normal Size"
msgstr ""
#: ../src/ld-window-main.c:169
msgid "Reset zoom level back to the default"
msgstr ""
#: ../src/ld-window-main.c:172
msgid "_Help"
msgstr ""
#: ../src/ld-window-main.c:173
msgid "_About"
msgstr ""
#: ../src/ld-window-main.c:174
msgid "Show a dialog about this application"
msgstr ""
#: ../src/ld-window-main.c:180
msgid "_Main Toolbar"
msgstr ""
#: ../src/ld-window-main.c:181
msgid "Toggle displaying of the main toolbar"
msgstr ""
#: ../src/ld-window-main.c:183
msgid "_Library Toolbar"
msgstr ""
#: ../src/ld-window-main.c:184
msgid "Toggle displaying of the library toolbar"
msgstr ""
#: ../src/ld-window-main.c:186
msgid "Show _Grid"
msgstr ""
#: ../src/ld-window-main.c:187
msgid "Toggle displaying of the grid"
msgstr ""
#: ../src/ld-window-main.c:525
msgid "Unsaved Diagram"
msgstr ""
#: ../src/ld-window-main.c:557
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and creating a new one?"
msgstr ""
#: ../src/ld-window-main.c:602
msgid "Failed to save the diagram"
msgstr ""
#: ../src/ld-window-main.c:605
msgid "Try again or save it under another name."
msgstr ""
#: ../src/ld-window-main.c:637
msgid "Failed to open the file"
msgstr ""
#: ../src/ld-window-main.c:640
msgid "The file is probably corrupted."
msgstr ""
#: ../src/ld-window-main.c:662
msgid "Logdiag Diagrams (*.ldd)"
msgstr ""
#: ../src/ld-window-main.c:679
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and opening another one?"
msgstr ""
#: ../src/ld-window-main.c:683
msgid "Open..."
msgstr ""
#: ../src/ld-window-main.c:714
msgid "Save As..."
msgstr ""
#: ../src/ld-window-main.c:767
msgid "If you don't save, changes will be permanently lost."
msgstr ""
#: ../src/ld-window-main.c:769
msgid "Close _without Saving"
msgstr ""
#: ../src/ld-window-main.c:807
#, c-format
msgid "Save the changes to diagram \"%s\" before closing?"
msgstr ""
#: ../src/ld-window-main.c:894
msgid "translator-credits"
msgstr ""
#: ../src/logdiag.c:42
msgid "[FILE] - Schematic editor"
msgstr "" msgstr ""

View File

@@ -30,7 +30,7 @@ if [ "$MAJOR" != "" ]; then
fi fi
# Finally make the template # Finally make the template
xgettext -LC -k_ -kN_:1,2 -kG_ $SOURCES -o "$PACKAGE".pot \ xgettext -LC -k_ -kN_ $SOURCES -o "$PACKAGE".pot \
--package-name="$PACKAGE" --package-version="$VERSION" \ --package-name="$PACKAGE" --package-version="$VERSION" \
--copyright-holder="Přemysl Janouch" --copyright-holder="Přemysl Janouch"

228
po/pl.po Normal file
View File

@@ -0,0 +1,228 @@
# Polish translation for logdiag.
# Copyright (C) 2011 Přemysl Janouch
# This file is distributed under the same license as the logdiag package.
# Robert Svoboda <ravath@gmail.com>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
"PO-Revision-Date: 2011-02-13 20:36+0100\n"
"Last-Translator: Robert Svoboda <ravath@gmail.com>\n"
"Language-Team: Polish <pl@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/ld-window-main.c:769
msgid "Close _without Saving"
msgstr "Zamknąć _bez zapisu"
#: ../src/ld-window-main.c:122
msgid "Create a new diagram"
msgstr "Stworzenie nowego wykresu"
#: ../src/ld-window-main.c:155
msgid "Delete the contents of the selection"
msgstr "Usuń zawartość wyboru"
#: ../src/ld-window-main.c:637
msgid "Failed to open the file"
msgstr "Pliku nie da się otworzyć"
#: ../src/ld-window-main.c:602
msgid "Failed to save the diagram"
msgstr "Nie udało się zapisać wykresu"
#: ../src/ld-window-main.c:767
msgid "If you don't save, changes will be permanently lost."
msgstr "Jeżeli nie zapiszesz zmian, zostaną one trwale utracone"
#: ../src/ld-window-main.c:662
msgid "Logdiag Diagrams (*.ldd)"
msgstr "Wykresy logdiag (*.ldd)"
#: ../src/ld-window-main.c:125
msgid "Open a diagram"
msgstr "Otwórz wykres"
#: ../src/ld-window-main.c:683
msgid "Open..."
msgstr "Otworzyć..."
#: ../src/ld-window-main.c:139
msgid "Quit the application"
msgstr "Zamknie aplikację"
#: ../src/ld-window-main.c:147
msgid "Redo the last undone action"
msgstr "Powtórzy ostatnio cofniętą akcję"
#: ../src/ld-window-main.c:169
msgid "Reset zoom level back to the default"
msgstr "Przywróci poziom zbliżenia na poziom wyjściowy"
#: ../src/ld-window-main.c:714
msgid "Save As..."
msgstr "Zapisz jako..."
#: ../src/ld-window-main.c:130
msgid "Save _As..."
msgstr "Zapisz _jako..."
#: ../src/ld-window-main.c:557
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and creating a new one?"
msgstr ""
"Zapisać zmiany w wykresie \"%s\" przed jego zamknięciem i stworzeniem nowego?"
#: ../src/ld-window-main.c:679
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and opening another one?"
msgstr ""
"Zapisać zmiany w wykresie \"%s\" przed jego zamknięciem i stworzeniem nowego?"
#: ../src/ld-window-main.c:807
#, c-format
msgid "Save the changes to diagram \"%s\" before closing?"
msgstr "Zapisać zmiany w wykresie \"%s\" przed jego zamknięciem?"
#: ../src/ld-window-main.c:128
msgid "Save the current diagram"
msgstr "Zapisz aktywny wykres"
#: ../src/ld-window-main.c:131
msgid "Save the current diagram with another name"
msgstr "Zapisać aktywny wykres pod inną nazwą"
#: ../src/ld-window-main.c:157
msgid "Select _All"
msgstr "Wybierz _wszystko"
#: ../src/ld-window-main.c:158
msgid "Select all objects in the diagram"
msgstr "Wybierze wszystkie obietky w wykresie"
#: ../src/ld-window-main.c:186
msgid "Show _Grid"
msgstr "Pokaż _Siatkę"
#: ../src/ld-window-main.c:174
msgid "Show a dialog about this application"
msgstr "Pokaże informacje o tej aplikacji"
#: ../src/ld-window-main.c:640
msgid "The file is probably corrupted."
msgstr "Plik jest prawdopodobnie uszkodzony."
#: ../src/ld-window-main.c:187
msgid "Toggle displaying of the grid"
msgstr "Przełączy pokazywanie siatki"
#: ../src/ld-window-main.c:184
msgid "Toggle displaying of the library toolbar"
msgstr "Przełączy pokazywanie panelu biblioteki"
#: ../src/ld-window-main.c:181
msgid "Toggle displaying of the main toolbar"
msgstr "Przełączy pokazywanie głównego panelu narzędzi"
#: ../src/ld-window-main.c:605
msgid "Try again or save it under another name."
msgstr "Spróbuj ponownie, bądź zapisz pod inną nazwą."
#: ../src/ld-window-main.c:144
msgid "Undo the last action"
msgstr "Cofnie ostatnią akcję"
#: ../src/ld-window-main.c:525
msgid "Unsaved Diagram"
msgstr "Niezapisany Wykres"
#: ../src/ld-window-main.c:165
msgid "Zoom _Out"
msgstr "_Oddalić widok"
#: ../src/ld-window-main.c:163
msgid "Zoom into the diagram"
msgstr "Przybliżyć widok"
#: ../src/ld-window-main.c:166
msgid "Zoom out of the diagram"
msgstr "Oddalić widok"
#: ../src/logdiag.c:42
msgid "[FILE] - Schematic editor"
msgstr "[SOUBOR] - Edytor schematów"
#: ../src/ld-window-main.c:173
msgid "_About"
msgstr "_O programie"
#: ../src/ld-window-main.c:154
msgid "_Delete"
msgstr "_Usuń"
#: ../src/ld-window-main.c:142
msgid "_Edit"
msgstr "_Edycja"
#: ../src/ld-window-main.c:120
msgid "_File"
msgstr "_Plik"
#: ../src/ld-window-main.c:172
msgid "_Help"
msgstr "_Pomoc"
#: ../src/ld-window-main.c:183
msgid "_Library Toolbar"
msgstr "Panel _biblioteki"
#: ../src/ld-window-main.c:180
msgid "_Main Toolbar"
msgstr "_Główny panel narzędzi"
#: ../src/ld-window-main.c:121
msgid "_New"
msgstr "_Nowy"
#: ../src/ld-window-main.c:168
msgid "_Normal Size"
msgstr "_Normalna Wielkość"
#: ../src/ld-window-main.c:124
msgid "_Open..."
msgstr "_Otwórz..."
#: ../src/ld-window-main.c:138
msgid "_Quit"
msgstr "_Zakończ"
#: ../src/ld-window-main.c:146
msgid "_Redo"
msgstr "_Powtórz"
#: ../src/ld-window-main.c:127
msgid "_Save"
msgstr "Z_apisz"
#: ../src/ld-window-main.c:143
msgid "_Undo"
msgstr "_Wróć"
#: ../src/ld-window-main.c:161
msgid "_View"
msgstr "_Widok"
#: ../src/ld-window-main.c:162
msgid "_Zoom In"
msgstr "_Przybliżyć"
#: ../src/ld-window-main.c:894
msgid "translator-credits"
msgstr "Robert Svoboda <ravath@gmail.com>"

227
po/sk.po Normal file
View File

@@ -0,0 +1,227 @@
# Slovak translation for logdiag.
# Copyright (C) 2011 Přemysl Janouch
# This file is distributed under the same license as the logdiag package.
# Miroslav Rigler <itsgoingd@luzer.sk>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
"PO-Revision-Date: 2011-03-06 16:26+0100\n"
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
"Language-Team: Slovak <sk@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/ld-window-main.c:769
msgid "Close _without Saving"
msgstr "Zatvoriť _bez uloženia"
#: ../src/ld-window-main.c:122
msgid "Create a new diagram"
msgstr "Vytvorí nový diagram"
#: ../src/ld-window-main.c:155
msgid "Delete the contents of the selection"
msgstr "Odstráni obsah výberu"
#: ../src/ld-window-main.c:637
msgid "Failed to open the file"
msgstr "Nepodarilo sa otvoriť súbor"
#: ../src/ld-window-main.c:602
msgid "Failed to save the diagram"
msgstr "Nepodarilo sa uložiť diagram"
#: ../src/ld-window-main.c:767
msgid "If you don't save, changes will be permanently lost."
msgstr "Ak ich neuložíte, budú zmeny navždy stratené."
#: ../src/ld-window-main.c:662
msgid "Logdiag Diagrams (*.ldd)"
msgstr "Diagramy logdiag (*.ldd)"
#: ../src/ld-window-main.c:125
msgid "Open a diagram"
msgstr "Otvorí diagram"
#: ../src/ld-window-main.c:683
msgid "Open..."
msgstr "Otvoriť..."
#: ../src/ld-window-main.c:139
msgid "Quit the application"
msgstr "Ukončí aplikáciu"
#: ../src/ld-window-main.c:147
msgid "Redo the last undone action"
msgstr "Vykoná naposledy vrátenú akciu"
#: ../src/ld-window-main.c:169
msgid "Reset zoom level back to the default"
msgstr "Vráti priblíženie na východiskovú hodnotu"
#: ../src/ld-window-main.c:714
msgid "Save As..."
msgstr "Uložiť ako..."
#: ../src/ld-window-main.c:130
msgid "Save _As..."
msgstr "Uložiť _ako..."
#: ../src/ld-window-main.c:557
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and creating a new one?"
msgstr ""
"Uložiť zmeny v diagrame \"%s\" pred jeho zatvorením a vytvorením nového?"
#: ../src/ld-window-main.c:679
#, c-format
msgid ""
"Save the changes to diagram \"%s\" before closing it and opening another one?"
msgstr "Uložiť zmeny v diagrame \"%s\" pred jeho zatvorením a otvorením iného?"
#: ../src/ld-window-main.c:807
#, c-format
msgid "Save the changes to diagram \"%s\" before closing?"
msgstr "Uložiť zmeny v diagrame \"%s\" pred jeho zatvorením?"
#: ../src/ld-window-main.c:128
msgid "Save the current diagram"
msgstr "Uloží aktuálny diagram"
#: ../src/ld-window-main.c:131
msgid "Save the current diagram with another name"
msgstr "Uloží aktuálny diagram pod iným menom"
#: ../src/ld-window-main.c:157
msgid "Select _All"
msgstr "Vybrať _všetko"
#: ../src/ld-window-main.c:158
msgid "Select all objects in the diagram"
msgstr "Vyberie všetky objekty v diagrame"
#: ../src/ld-window-main.c:186
msgid "Show _Grid"
msgstr "Zobraziť _mriežku"
#: ../src/ld-window-main.c:174
msgid "Show a dialog about this application"
msgstr "Zobrazí dialóg o tejto aplikácii"
#: ../src/ld-window-main.c:640
msgid "The file is probably corrupted."
msgstr "Súbor je pravdepodobne poškodený."
#: ../src/ld-window-main.c:187
msgid "Toggle displaying of the grid"
msgstr "Prepne zobrazovanie mriežky"
#: ../src/ld-window-main.c:184
msgid "Toggle displaying of the library toolbar"
msgstr "Prepne zobrazovanie panelu knižnice"
#: ../src/ld-window-main.c:181
msgid "Toggle displaying of the main toolbar"
msgstr "Prepne zobrazovanie hlavného panelu nástrojov"
#: ../src/ld-window-main.c:605
msgid "Try again or save it under another name."
msgstr "Skúste to znova alebo ho uložte pod iným názvom."
#: ../src/ld-window-main.c:144
msgid "Undo the last action"
msgstr "Vráti poslednú akciu"
#: ../src/ld-window-main.c:525
msgid "Unsaved Diagram"
msgstr "Neuložený diagram"
#: ../src/ld-window-main.c:165
msgid "Zoom _Out"
msgstr "_Oddialiť"
#: ../src/ld-window-main.c:163
msgid "Zoom into the diagram"
msgstr "Priblíži diagram"
#: ../src/ld-window-main.c:166
msgid "Zoom out of the diagram"
msgstr "Oddiali diagram"
#: ../src/logdiag.c:42
msgid "[FILE] - Schematic editor"
msgstr "[SÚBOR] - Editor schém"
#: ../src/ld-window-main.c:173
msgid "_About"
msgstr "_O programe"
#: ../src/ld-window-main.c:154
msgid "_Delete"
msgstr "_Zmazať"
#: ../src/ld-window-main.c:142
msgid "_Edit"
msgstr "_Úpravy"
#: ../src/ld-window-main.c:120
msgid "_File"
msgstr "_Súbor"
#: ../src/ld-window-main.c:172
msgid "_Help"
msgstr "_Nápoveda"
#: ../src/ld-window-main.c:183
msgid "_Library Toolbar"
msgstr "Panel _knižnice"
#: ../src/ld-window-main.c:180
msgid "_Main Toolbar"
msgstr "_Hlavný panel nástrojov"
#: ../src/ld-window-main.c:121
msgid "_New"
msgstr "_Nový"
#: ../src/ld-window-main.c:168
msgid "_Normal Size"
msgstr "_Normálna veľkosť"
#: ../src/ld-window-main.c:124
msgid "_Open..."
msgstr "_Otvoriť..."
#: ../src/ld-window-main.c:138
msgid "_Quit"
msgstr "U_končiť"
#: ../src/ld-window-main.c:146
msgid "_Redo"
msgstr "Z_novu"
#: ../src/ld-window-main.c:127
msgid "_Save"
msgstr "_Uložiť"
#: ../src/ld-window-main.c:143
msgid "_Undo"
msgstr "_Späť"
#: ../src/ld-window-main.c:161
msgid "_View"
msgstr "_Zobrazenie"
#: ../src/ld-window-main.c:162
msgid "_Zoom In"
msgstr "_Priblížiť"
#: ../src/ld-window-main.c:894
msgid "translator-credits"
msgstr "Miroslav Rigler <itsgoingd@luzer.sk>"

View File

@@ -26,6 +26,11 @@
<menuitem action="SelectAll" /> <menuitem action="SelectAll" />
</menu> </menu>
<menu name="ViewMenu" action="ViewMenu"> <menu name="ViewMenu" action="ViewMenu">
<menuitem action="MainToolbar" />
<menuitem action="LibraryToolbar" />
<separator />
<menuitem action="ShowGrid" />
<separator />
<menuitem action="ZoomIn" /> <menuitem action="ZoomIn" />
<menuitem action="ZoomOut" /> <menuitem action="ZoomOut" />
<menuitem action="NormalSize" /> <menuitem action="NormalSize" />

BIN
share/header.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

159
share/header.svg Normal file
View File

@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="57"
id="svg2">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
width="150"
height="57"
x="0"
y="-1.3322676e-15"
id="rect3078"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
<g
transform="translate(0,-995.36218)"
id="layer1">
<g
transform="matrix(0.33083214,0,0,0.33083214,7.3082845,1004.0193)"
id="g3077">
<g
transform="translate(0,-926.86216)"
id="layer1-4"
style="fill:none;stroke:#ffffff;stroke-width:22.81488991;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
<g
transform="translate(-10,-60)"
id="g3016-5"
style="stroke-width:22.81488991">
<path
d="m 25,108 20,0"
transform="translate(0,924.36218)"
id="path3008-0"
style="stroke-width:22.81488991" />
<path
d="m 25,88 20,0"
transform="translate(0,924.36218)"
id="path3010-3"
style="stroke-width:22.81488991" />
<path
d="m 45,118 0,-40 25,0 c 0,0 20,0 20,20 0,20 -20,20 -20,20 z"
transform="translate(0,924.36218)"
id="path3012-6"
style="stroke-width:22.81488991" />
<path
d="m 90,98 20,0"
transform="translate(0,924.36218)"
id="path3014-1"
style="stroke-width:22.81488991" />
</g>
<g
transform="translate(10,-5.00002)"
id="g3016-8-0"
style="stroke-width:22.81488991">
<path
d="m 25,1022.3622 20,0"
id="path3010-0-6"
style="stroke-width:22.81488991" />
<path
d="M 45,118 45,78 75,98 z"
transform="translate(0,924.36218)"
id="path3012-9-3"
style="stroke-width:22.81488991" />
<path
d="m 87.5,1022.3622 17.5,0"
id="path3014-6-2"
style="stroke-width:22.81488991" />
<path
d="m 100,93 a 10,10 0 1 1 -20,0 10,10 0 1 1 20,0 z"
transform="matrix(0.5,0,0,0.5,37,975.86218)"
id="path3820-0"
style="stroke-width:45.62977982" />
</g>
</g>
<g
transform="translate(0,-926.86216)"
id="layer1-5"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.33746958;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
<g
transform="translate(-10,-60)"
id="g3016"
style="stroke-width:6.33746958">
<path
d="m 25,108 20,0"
transform="translate(0,924.36218)"
id="path3008"
style="stroke-width:6.33746958" />
<path
d="m 25,88 20,0"
transform="translate(0,924.36218)"
id="path3010"
style="stroke-width:6.33746958" />
<path
d="m 45,118 0,-40 25,0 c 0,0 20,0 20,20 0,20 -20,20 -20,20 z"
transform="translate(0,924.36218)"
id="path3012"
style="stroke-width:6.33746958" />
<path
d="m 90,98 20,0"
transform="translate(0,924.36218)"
id="path3014"
style="stroke-width:6.33746958" />
</g>
<g
transform="translate(10,-5.00002)"
id="g3016-8"
style="stroke-width:6.33746958">
<path
d="m 25,1022.3622 20,0"
id="path3010-0"
style="stroke-width:6.33746958" />
<path
d="M 45,118 45,78 75,98 z"
transform="translate(0,924.36218)"
id="path3012-9"
style="stroke-width:6.33746958" />
<path
d="m 87.5,1022.3622 17.5,0"
id="path3014-6"
style="stroke-width:6.33746958" />
<path
d="m 100,93 a 10,10 0 1 1 -20,0 10,10 0 1 1 20,0 z"
transform="matrix(0.5,0,0,0.5,37,975.86218)"
id="path3820"
style="stroke-width:12.67493916" />
</g>
</g>
</g>
<text
x="56.96154"
y="1029.7422"
id="text3103"
xml:space="preserve"
style="font-size:22.81624222px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu"><tspan
x="56.96154"
y="1029.7422"
id="tspan3105"
style="font-size:20px;font-weight:bold">logdiag</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,79 @@
-- Symbol names
local names_npn =
{
en = "NPN transistor",
cs = "Tranzistor NPN",
sk = "Tranzistor NPN",
pl = "Tranzystor NPN",
de = "NPN Transistor"
}
local names_pnp =
{
en = "PNP transistor",
cs = "Tranzistor PNP",
sk = "Tranzistor PNP",
pl = "Tranzystor PNP",
de = "PNP Transistor"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-2, -2, 2, 2}
-- Terminal points
local terminals = {{-2, 0}, {2, 2}, {2, -2}}
-- Rendering
local render = function (cr)
-- The terminals
cr.move_to (-2, 0)
cr.line_to (0, 0)
cr.move_to (0, 0.5)
cr.line_to (2, 2)
cr.move_to (0, -0.5)
cr.line_to (2, -2)
-- The ohmic connection
cr.move_to (0, -1)
cr.line_to (0, 1)
cr.stroke ()
end
local render_npn = function (cr)
render (cr)
cr.save ()
cr.translate (0, 0.5)
cr.rotate (math.atan2 (-2, 1.5))
cr.move_to (-0.4, 0.8)
cr.line_to (0, 1.4)
cr.line_to (0.4, 0.8)
cr.stroke ()
cr.restore ()
end
local render_pnp = function (cr)
render (cr)
cr.save ()
cr.translate (2, -2)
cr.rotate (math.atan2 (2, 1.5))
cr.move_to (-0.4, 1.3)
cr.line_to (0, 1.9)
cr.line_to (0.4, 1.3)
cr.stroke ()
cr.restore ()
end
-- Register the symbols
logdiag.register ("NPN", names_npn, area, terminals, render_npn)
logdiag.register ("PNP", names_pnp, area, terminals, render_pnp)

View File

@@ -0,0 +1,8 @@
{
"en": "Active",
"cs": "Aktivní",
"sk": "Aktívne",
"pl": "Aktywne",
"de": "Aktiv"
}

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="128"
height="128"
id="svg2">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-3,-1)"
id="g3774"
style="fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
<path
d="m 20,63 45,0"
id="path3764"
style="fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 65,38 0,50"
id="path3766"
style="fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="M 65,53 110,23"
id="path3768"
style="fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 65,73 45,30"
id="path3770"
style="fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="M 78,92 93,92 88,77"
id="path3772"
style="fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,89 @@
-- Symbol names
local names_n =
{
en = "N-channel IGFET transistor",
cs = "Tranzistor IGFET s kanálem N",
sk = "Tranzistor IGFET s kanálom N",
pl = "Tranzystor IGFET z kanałem N",
de = "N-Kanal IGFET Transistor"
}
local names_p =
{
en = "P-channel IGFET transistor",
cs = "Tranzistor IGFET s kanálem P",
sk = "Tranzistor IGFET s kanálom P",
pl = "Tranzystor IGFET z kanałem P",
de = "P-Kanal IGFET Transistor"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-2, -1.5, 2, 1.5}
-- Terminal points
local terminals_n = {{-2, 1}, {2, 1}, {2, 0}, {2, -1}}
local terminals_p = {{-2, -1}, {2, 1}, {2, 0}, {2, -1}}
-- Rendering
local render = function (cr)
-- The terminals
cr.move_to (-0.3, 1)
cr.line_to (-0.3, -1)
cr.move_to (0, 1)
cr.line_to (2, 1)
cr.move_to (0, 0)
cr.line_to (2, 0)
cr.move_to (0, -1)
cr.line_to (2, -1)
-- Source, gate, drain
cr.move_to (0, -1.5)
cr.line_to (0, -0.5)
cr.move_to (0, -0.3)
cr.line_to (0, 0.3)
cr.move_to (0, 0.5)
cr.line_to (0, 1.5)
cr.stroke ()
end
local render_n = function (cr)
render (cr)
-- The left-side terminal
cr.move_to (-2, 1)
cr.line_to (-0.3, 1)
-- The arrow
cr.move_to (0.9, -0.4)
cr.line_to (0.4, 0)
cr.line_to (0.9, 0.4)
cr.stroke ()
end
local render_p = function (cr)
render (cr)
-- The left-side terminal
cr.move_to (-2, -1)
cr.line_to (-0.3, -1)
-- The arrow
cr.move_to (0.4, -0.4)
cr.line_to (0.9, 0)
cr.line_to (0.4, 0.4)
cr.stroke ()
end
-- Register the symbols
logdiag.register ("IGFET-N", names_n, area, terminals_n, render_n)
logdiag.register ("IGFET-P", names_p, area, terminals_p, render_p)

View File

@@ -0,0 +1,77 @@
-- Symbol names
local names_n =
{
en = "N-channel JFET transistor",
cs = "Tranzistor JFET s kanálem N",
sk = "Tranzistor JFET s kanálom N",
pl = "Tranzystor JFET z kanałem N",
de = "N-Kanal JFET Transistor"
}
local names_p =
{
en = "P-channel JFET transistor",
cs = "Tranzistor JFET s kanálem P",
sk = "Tranzistor JFET s kanálom P",
pl = "Tranzystor JFET z kanałem P",
de = "P-Kanal JFET Transistor"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-2, -1.5, 2, 1.5}
-- Terminal points
local terminals_n = {{-2, 1}, {2, 1}, {2, -1}}
local terminals_p = {{-2, -1}, {2, 1}, {2, -1}}
-- Rendering
local render = function (cr)
-- The terminals
cr.move_to (0, 1)
cr.line_to (2, 1)
cr.move_to (0, -1)
cr.line_to (2, -1)
-- The ohmic connection
cr.move_to (0, -1.5)
cr.line_to (0, 1.5)
cr.stroke ()
end
local render_n = function (cr)
render (cr)
-- The left-side terminal
cr.move_to (-2, 1)
cr.line_to (0, 1)
-- The arrow
cr.move_to (-1, 0.6)
cr.line_to (-0.5, 1)
cr.line_to (-1, 1.4)
cr.stroke ()
end
local render_p = function (cr)
render (cr)
-- The left-side terminal
cr.move_to (-2, -1)
cr.line_to (0, -1)
-- The arrow
cr.move_to (-0.4, -0.6)
cr.line_to (-1, -1)
cr.line_to (-0.4, -1.4)
cr.stroke ()
end
-- Register the symbols
logdiag.register ("JFET-N", names_n, area, terminals_n, render_n)
logdiag.register ("JFET-P", names_p, area, terminals_p, render_p)

View File

@@ -1,37 +1,38 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "AND", en = "AND",
cs = "AND" cs = "AND",
sk = "AND",
pl = "AND",
de = "UND"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-4, -2, 5, 2} local area = {-4, -2, 5, 2}
-- Terminals -- Terminal points
terminals = {{-4, -1}, {-4, 1}, {5, 0}} local terminals = {{-4, -1}, {-4, 1}, {5, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The main shape -- The main shape
cr.move_to (-2, -2) cr.move_to (-2, -2)
cr.line_to (1, -2) cr.line_to (1, -2)
cr.arc (1, 0, 2, math.pi * 1.5, math.pi * 0.5) cr.arc (1, 0, 2, math.pi * 1.5, math.pi * 0.5)
cr.line_to (-2, 2) cr.line_to (-2, 2)
cr.close_path () cr.close_path ()
cr.stroke ()
-- The contacts -- The terminals
cr.move_to (-4, -1) cr.move_to (-4, -1)
cr.line_to (-2, -1) cr.line_to (-2, -1)
cr.stroke ()
cr.move_to (-4, 1) cr.move_to (-4, 1)
cr.line_to (-2, 1) cr.line_to (-2, 1)
cr.stroke ()
cr.move_to (3, 0) cr.move_to (3, 0)
cr.line_to (5, 0) cr.line_to (5, 0)
cr.stroke () cr.stroke ()
end end

View File

@@ -1,5 +1,7 @@
{ {
"en": "Logical", "en": "Logical",
"cs": "Logické" "cs": "Logické",
"sk": "Logické",
"pl": "Logiczne"
} }

View File

@@ -1,37 +1,38 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "NOT", en = "NOT",
cs = "NOT" cs = "NOT",
sk = "NOT",
pl = "NOT",
de = "NICHT"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-4, -2, 4, 2} local area = {-4, -2, 4, 2}
-- Terminals -- Terminal points
terminals = {{-4, 0}, {4, 0}} local terminals = {{-4, 0}, {4, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The triangle -- The triangle
cr.move_to (-2, -2) cr.move_to (-2, -2)
cr.line_to (2, 0) cr.line_to (2, 0)
cr.line_to (-2, 2) cr.line_to (-2, 2)
cr.close_path () cr.close_path ()
cr.stroke ()
-- The circle -- The circle
cr.new_sub_path () cr.new_sub_path ()
cr.arc (2.25, 0, 0.25, 0, 2 * math.pi) cr.arc (2.25, 0, 0.25, 0, 2 * math.pi)
cr.stroke ()
-- The contacts -- The terminals
cr.move_to (-4, 0) cr.move_to (-4, 0)
cr.line_to (-2, 0) cr.line_to (-2, 0)
cr.stroke ()
cr.move_to (2.5, 0) cr.move_to (2.5, 0)
cr.line_to (4, 0) cr.line_to (4, 0)
cr.stroke () cr.stroke ()
end end

View File

@@ -1,18 +1,21 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "OR", en = "OR",
cs = "OR" cs = "OR",
sk = "OR",
pl = "OR",
de = "ODER"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-4, -2, 5, 2} local area = {-4, -2, 5, 2}
-- Terminals -- Terminal points
terminals = {{-4, -1}, {-4, 1}, {5, 0}} local terminals = {{-4, -1}, {-4, 1}, {5, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The main shape -- The main shape
cr.move_to (-2, -2) cr.move_to (-2, -2)
cr.line_to (0, -2) cr.line_to (0, -2)
@@ -22,7 +25,7 @@ render = function (cr)
cr.curve_to (-1, 1, -1, -1, -2, -2) cr.curve_to (-1, 1, -1, -1, -2, -2)
cr.stroke () cr.stroke ()
-- The contacts -- The terminals
cr.save () cr.save ()
-- Crop the contacts according to -- Crop the contacts according to
@@ -36,12 +39,11 @@ render = function (cr)
cr.move_to (-4, -1) cr.move_to (-4, -1)
cr.line_to (-1, -1) cr.line_to (-1, -1)
cr.stroke ()
cr.move_to (-4, 1) cr.move_to (-4, 1)
cr.line_to (-1, 1) cr.line_to (-1, 1)
cr.stroke ()
cr.stroke ()
cr.restore () cr.restore ()
cr.move_to (3, 0) cr.move_to (3, 0)

View File

@@ -1,5 +1,8 @@
{ {
"en": "Miscellaneous", "en": "Miscellaneous",
"cs": "Smíšené" "cs": "Smíšené",
"sk": "Zmiešané",
"pl": "Różne",
"de": "Diverse"
} }

View File

@@ -1,18 +1,21 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "Power source", en = "Cell",
cs = "Zdroj napětí" cs = "Článek",
sk = "Článok",
pl = "Ogniwo",
de = "Zelle"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-1, -2, 1, 2} local area = {-1, -2, 1, 2}
-- Terminals -- Terminal points
terminals = {{-1, 0}, {1, 0}} local terminals = {{-1, 0}, {1, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The vertical lines -- The vertical lines
cr.move_to (-0.2, -1) cr.move_to (-0.2, -1)
cr.line_to (-0.2, 1) cr.line_to (-0.2, 1)
@@ -20,7 +23,7 @@ render = function (cr)
cr.move_to (0.2, -2) cr.move_to (0.2, -2)
cr.line_to (0.2, 2) cr.line_to (0.2, 2)
-- The contacts -- The terminals
cr.move_to (-1, 0) cr.move_to (-1, 0)
cr.line_to (-0.2, 0) cr.line_to (-0.2, 0)
@@ -31,6 +34,6 @@ render = function (cr)
end end
-- Register the symbol -- Register the symbol
logdiag.register ("PowerSource", names, area, terminals, render) logdiag.register ("Cell", names, area, terminals, render)

View File

@@ -1,18 +1,21 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "Ground", en = "Ground",
cs = "Zem" cs = "Zem",
sk = "Uzemnenie",
pl = "Ziemia",
de = "Masse"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-1, -1, 1, 2} local area = {-1, -1, 1, 2}
-- Terminals -- Terminal points
terminals = {{0, -1}} local terminals = {{0, -1}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The vertical line -- The vertical line
cr.move_to (0, -1) cr.move_to (0, -1)
cr.line_to (0, 0.5) cr.line_to (0, 0.5)

View File

@@ -0,0 +1,27 @@
-- Symbol name
local names =
{
en = "Junction",
cs = "Spoj",
sk = "Spoj",
pl = "Złącze",
de = "Anschluss"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-0.5, -0.5, 0.5, 0.5}
-- Terminal points
local terminals = {}
-- Rendering
local render = function (cr)
-- The disk
cr.arc (0, 0, 0.3, 0, math.pi * 2)
cr.fill ()
end
-- Register the symbol
logdiag.register ("Junction", names, area, terminals, render)

View File

@@ -1,18 +1,21 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "Lamp", en = "Lamp",
cs = "Světelný zdroj" cs = "Světelný zdroj",
sk = "Svetelný zdroj",
pl = "Źródło światła",
de = "Lampe"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-2, -1, 2, 1} local area = {-2, -1, 2, 1}
-- Terminals -- Terminal points
terminals = {{-2, 0}, {2, 0}} local terminals = {{-2, 0}, {2, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The circle -- The circle
cr.save () cr.save ()
@@ -25,16 +28,17 @@ render = function (cr)
cr.move_to (1, -1) cr.move_to (1, -1)
cr.line_to (-1, 1) cr.line_to (-1, 1)
cr.stroke ()
cr.stroke ()
cr.restore () cr.restore ()
-- The contacts -- The terminals
cr.move_to (-2, 0) cr.move_to (-2, 0)
cr.line_to (-1, 0) cr.line_to (-1, 0)
cr.move_to (1, 0) cr.move_to (1, 0)
cr.line_to (2, 0) cr.line_to (2, 0)
cr.stroke () cr.stroke ()
end end

View File

@@ -0,0 +1,84 @@
-- Symbol names
local names_A =
{
en = "Ammeter",
cs = "Ampérmetr",
sk = "Ampérmeter",
pl = "Amperomierz",
de = "Ampermeter"
}
local names_V =
{
en = "Voltmeter",
cs = "Voltmetr",
sk = "Voltmeter",
pl = "Woltomierz",
de = "Voltmeter"
}
local names_ohm =
{
en = "Ohmmeter",
cs = "Ohmmetr",
sk = "Ohmmeter",
pl = "Omomierz",
de = "Ohmmeter"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-2, -2, 2, 2}
-- Terminal points
local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
-- Rendering
local render_A = function (cr)
-- The circle
cr.arc (0, 0, 2, 0, math.pi * 2)
-- The letter A
cr.move_to (-0.4, 0.5)
cr.line_to (0, -0.5)
cr.line_to (0.4, 0.5)
cr.move_to (-0.3, 0.25)
cr.line_to (0.3, 0.25)
cr.stroke ()
end
local render_V = function (cr)
-- The circle
cr.arc (0, 0, 2, 0, math.pi * 2)
-- The letter V
cr.move_to (-0.4, -0.5)
cr.line_to (0, 0.5)
cr.line_to (0.4, -0.5)
cr.stroke ()
end
local render_ohm = function (cr)
-- The circle
cr.arc (0, 0, 2, 0, math.pi * 2)
-- The capital letter omega
cr.move_to (-0.5, 0.5)
cr.line_to (-0.15, 0.5)
cr.curve_to (-0.15, 0.5, -0.4, 0.3, -0.4, 0)
cr.curve_to (-0.4, -0.25, -0.25, -0.5, 0, -0.5)
cr.curve_to (0.25, -0.5, 0.4, -0.25, 0.4, 0)
cr.curve_to (0.4, 0.3, 0.15, 0.5, 0.15, 0.5)
cr.line_to (0.5, 0.5)
cr.stroke ()
end
-- Register the symbols
logdiag.register ("Ammeter", names_A, area, terminals, render_A)
logdiag.register ("Voltmeter", names_V, area, terminals, render_V)
logdiag.register ("Ohmmeter", names_ohm, area, terminals, render_ohm)

View File

@@ -0,0 +1,50 @@
-- Symbol names
local names_plus =
{
en = "Plus sign",
cs = "Znaménko plus",
sk = "Znamienko plus",
pl = "Znaczek plus",
de = "Pluszeichen"
}
local names_minus =
{
en = "Minus sign",
cs = "Znaménko mínus",
sk = "Znamienko mínus",
pl = "Znaczek minus",
de = "Minuszeichen"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-0.5, -0.5, 0.5, 0.5}
-- Terminal points
local terminals = {}
-- Rendering
local render_plus = function (cr)
-- The plus sign
cr.move_to (0, -0.4)
cr.line_to (0, 0.4)
cr.move_to (-0.4, 0)
cr.line_to (0.4, 0)
cr.stroke ()
end
local render_minus = function (cr)
-- The minus sign
cr.move_to (-0.4, 0)
cr.line_to (0.4, 0)
cr.stroke ()
end
-- Register the symbols
logdiag.register ("SignPlus", names_plus, area, terminals, render_plus)
logdiag.register ("SignMinus", names_minus, area, terminals, render_minus)

View File

@@ -1,23 +1,26 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "Switch", en = "Switch",
cs = "Spínač" cs = "Spínač",
sk = "Spínač",
pl = "Przełącznik",
de = "Schalter"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-2, -1.5, 2, 0} local area = {-2, -1.5, 2, 0}
-- Terminals -- Terminal points
terminals = {{-2, 0}, {2, 0}} local terminals = {{-2, 0}, {2, 0}}
-- Rendering -- Rendering
render_normal = function (cr) local render = function (cr)
-- The switch contact -- The switch contact
cr.move_to (1.3, -1.3) cr.move_to (1.3, -1.3)
cr.line_to (-1, 0) cr.line_to (-1, 0)
-- The contacts -- The terminals
cr.move_to (-2, 0) cr.move_to (-2, 0)
cr.line_to (-1, 0) cr.line_to (-1, 0)
@@ -28,6 +31,6 @@ render_normal = function (cr)
end end
-- Register the symbol -- Register the symbol
logdiag.register ("Switch", names, area, terminals, render_normal) logdiag.register ("Switch", names, area, terminals, render)

View File

@@ -0,0 +1,32 @@
-- Symbol name
local names =
{
en = "Terminal",
cs = "Terminál",
sk = "Terminál",
pl = "Terminał",
de = "Terminal"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-1, -0.5, 0.5, 0.5}
-- Terminal points
local terminals = {{-1, 0}}
-- Rendering
local render = function (cr)
-- The circle
cr.arc (0, 0, 0.3, 0, math.pi * 2)
-- The contact
cr.move_to (-1, 0)
cr.line_to (-0.3, 0)
cr.stroke ()
end
-- Register the symbol
logdiag.register ("Terminal", names, area, terminals, render)

View File

@@ -0,0 +1,64 @@
-- Symbol names
local names_ac =
{
en = "AC voltage source",
cs = "Střídavý zdroj napětí",
sk = "Striedavý zdroj napätia",
pl = "Źródło prądu zmiennego",
de = "Wechselstromquelle"
}
local names_dc =
{
en = "DC voltage source",
cs = "Stejnosměrný zdroj napětí",
sk = "Stejnosmerný zdroj napätia",
pl = "Źródło prądu stałego",
de = "Gleichstromquelle"
}
-- Render area in base units (X1, Y1, X2, Y2)
local area = {-2, -2, 2, 2}
-- Terminal points
local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}}
-- Rendering
local render = function (cr)
-- The circle
cr.arc (0, 0, 2, 0, math.pi * 2)
cr.stroke ()
end
local render_ac = function (cr)
render (cr)
-- The AC symbol
cr.move_to (-1, 0.25)
cr.curve_to (-0.4, -1.5, 0.4, 1.5, 1, -0.25)
cr.stroke ()
end
local render_dc = function (cr)
render (cr)
-- The DC symbol
cr.move_to (-1, -0.25)
cr.line_to (1, -0.25)
cr.move_to (-1, 0.25)
cr.line_to (-0.2, 0.25)
cr.move_to (0.2, 0.25)
cr.line_to (1, 0.25)
cr.stroke ()
end
-- Register the symbols
logdiag.register ("ACSource", names_ac, area, terminals, render_ac)
logdiag.register ("DCSource", names_dc, area, terminals, render_dc)

View File

@@ -1,34 +1,35 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "Capacitor", en = "Capacitor",
cs = "Kondenzátor" cs = "Kondenzátor",
sk = "Kondenzátor",
pl = "Kondensator",
de = "Kondensator"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-2, -1, 2, 1} local area = {-2, -1, 2, 1}
-- Terminals -- Terminal points
terminals = {{-2, 0}, {2, 0}} local terminals = {{-2, 0}, {2, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The vertical lines -- The vertical lines
cr.move_to (-0.2, -1) cr.move_to (-0.2, -1)
cr.line_to (-0.2, 1) cr.line_to (-0.2, 1)
cr.stroke ()
cr.move_to (0.2, -1) cr.move_to (0.2, -1)
cr.line_to (0.2, 1) cr.line_to (0.2, 1)
cr.stroke ()
-- The contacts -- The terminals
cr.move_to (-2, 0) cr.move_to (-2, 0)
cr.line_to (-0.2, 0) cr.line_to (-0.2, 0)
cr.stroke ()
cr.move_to (0.2, 0) cr.move_to (0.2, 0)
cr.line_to (2, 0) cr.line_to (2, 0)
cr.stroke () cr.stroke ()
end end

View File

@@ -1,5 +1,8 @@
{ {
"en": "Passive", "en": "Passive",
"cs": "Pasivní" "cs": "Pasivní",
"sk": "Pasívne",
"pl": "Pasywne",
"de": "Passiv"
} }

View File

@@ -1,41 +1,129 @@
-- Symbol name -- Symbol names
names = local names =
{ {
en = "Diode", en = "Diode",
cs = "Dioda" cs = "Dioda",
sk = "Dióda",
pl = "Dioda",
de = "Diode"
}
local names_zener =
{
en = "Zener diode",
cs = "Zenerova dioda",
sk = "Zenerova dióda",
pl = "Dioda Zenera",
de = "Zenerdiode"
}
local names_led =
{
en = "Light-emitting diode",
cs = "Svítivá dioda",
sk = "Svietivá dióda",
pl = "Dioda świecąca",
de = "Lichtemittierende Diode"
}
local names_photo =
{
en = "Photodiode",
cs = "Fotodioda",
sk = "Fotodióda",
pl = "Fotodioda",
de = "Fotodiode"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-2, -1, 2, 1} local area = {-2, -1, 2, 1}
local area_rad = {-2, -2.5, 2, 1}
-- Terminals -- Terminal points
terminals = {{-2, 0}, {2, 0}} local terminals = {{-2, 0}, {2, 0}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The triangle -- The triangle
cr.move_to (-1, -1) cr.move_to (-1, -1)
cr.line_to (1, 0) cr.line_to (1, 0)
cr.line_to (-1, 1) cr.line_to (-1, 1)
cr.line_to (-1, -1) cr.line_to (-1, -1)
cr.stroke ()
-- The vertical line -- The vertical line
cr.move_to (1, 1) cr.move_to (1, 1)
cr.line_to (1, -1) cr.line_to (1, -1)
cr.stroke ()
-- The contacts -- The terminals
cr.move_to (-2, 0) cr.move_to (-2, 0)
cr.line_to (-1, 0)
cr.stroke ()
cr.move_to (1, 0)
cr.line_to (2, 0) cr.line_to (2, 0)
cr.stroke () cr.stroke ()
end end
local render_zener = function (cr)
render (cr)
cr.move_to (1, 1)
cr.line_to (0.5, 1)
cr.stroke ()
end
local render_arrow = function (cr)
cr.move_to (0, 0)
cr.line_to (0, -1.5)
cr.stroke ()
cr.move_to (-0.3, -0.7)
cr.line_to (0, -1.5)
cr.line_to (0.3, -0.7)
cr.close_path ()
cr.fill ()
end
local render_radiation = function (cr)
cr.save ()
cr.translate (-0.4, 0)
render_arrow (cr)
cr.restore ()
cr.save ()
cr.translate (0.4, 0)
render_arrow (cr)
cr.restore ()
end
local render_led = function (cr)
render (cr)
cr.save ()
cr.translate (-0.3, -1.0)
cr.rotate (math.atan2 (1, 1))
render_radiation (cr)
cr.restore ()
end
local render_photo = function (cr)
render (cr)
cr.save ()
cr.translate (0.75, -2.05)
cr.rotate (math.atan2 (-1, -1))
render_radiation (cr)
cr.restore ()
end
-- Register the symbol -- Register the symbol
logdiag.register ("Diode", names, area, terminals, render) logdiag.register ("Diode", names, area, terminals, render)
logdiag.register ("DiodeZener", names_zener, area, terminals, render_zener)
logdiag.register ("DiodeLED", names_led, area_rad, terminals, render_led)
logdiag.register ("DiodePhoto", names_photo, area_rad, terminals, render_photo)

View File

@@ -1,43 +1,51 @@
-- Symbol names -- Symbol names
names_normal = local names =
{ {
en = "Inductor", en = "Inductor",
cs = "Cívka" cs = "Cívka",
sk = "Cievka",
pl = "Cewka",
de = "Spule"
} }
names_core = local names_core =
{ {
en = "Inductor with magnetic core", en = "Inductor with magnetic core",
cs = "Cívka s magnetickým jádrem" cs = "Cívka s magnetickým jádrem",
sk = "Cievka s magnetickým jadrom",
pl = "Cewka z jądrem magnetycznym",
de = "Magnetspule"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-2, -1, 2, 0} local area = {-2, -1, 2, 0}
-- Terminals -- Terminal points
terminals = {{-2, 0}, {2, 0}} local terminals = {{-2, 0}, {2, 0}}
-- Rendering -- Rendering
render_normal = function (cr) local render = function (cr)
-- The arcs -- The arcs
cr.arc (-1.5, 0, 0.5, math.pi, 0) cr.arc (-1.5, 0, 0.5, math.pi, 0)
cr.arc (-0.5, 0, 0.5, math.pi, 0) cr.arc (-0.5, 0, 0.5, math.pi, 0)
cr.arc (0.5, 0, 0.5, math.pi, 0) cr.arc (0.5, 0, 0.5, math.pi, 0)
cr.arc (1.5, 0, 0.5, math.pi, 0) cr.arc (1.5, 0, 0.5, math.pi, 0)
cr.stroke () cr.stroke ()
end end
render_core = function (cr) local render_core = function (cr)
render_normal (cr) render (cr)
-- The core -- The core
cr.move_to (-2, -1) cr.move_to (-2, -1)
cr.line_to (2, -1) cr.line_to (2, -1)
cr.stroke () cr.stroke ()
end end
-- Register the symbols -- Register the symbols
logdiag.register ("Inductor", names_normal, area, terminals, render_normal) logdiag.register ("Inductor", names, area, terminals, render)
logdiag.register ("InductorWithCore", names_core, area, terminals, render_core) logdiag.register ("InductorWithCore", names_core, area, terminals, render_core)

View File

@@ -1,37 +1,108 @@
-- Symbol name -- Symbol name
names = local names =
{ {
en = "Resistor", en = "Resistor",
cs = "Rezistor" cs = "Rezistor",
sk = "Rezistor",
pl = "Rezystor",
de = "Widerstand"
}
local names_adj =
{
en = "Adjustable resistor",
cs = "Nastavitelný rezistor",
sk = "Nastaviteľný rezistor",
pl = "Rezystor zmienny",
de = "Einstellwiderstand"
}
local names_pot =
{
en = "Potentiometer",
cs = "Potenciometr",
sk = "Potenciometer",
pl = "Potencjometr",
de = "Potentiometer"
} }
-- Render area in base units (X1, Y1, X2, Y2) -- Render area in base units (X1, Y1, X2, Y2)
area = {-2, -0.5, 2, 0.5} local area = {-2, -0.5, 2, 0.5}
local area_adj = {-2, -1.5, 2, 1}
local area_pot = {-2, -2, 2, 0.5}
-- Terminals -- Terminal points
terminals = {{-2, 0}, {2, 0}} local terminals = {{-2, 0}, {2, 0}}
local terminals_pot = {{-2, 0}, {2, 0}, {2, -2}}
-- Rendering -- Rendering
render = function (cr) local render = function (cr)
-- The rectangle -- The rectangle
cr.move_to (-1.5, -0.5) cr.move_to (-1.5, -0.5)
cr.line_to (1.5, -0.5) cr.line_to (1.5, -0.5)
cr.line_to (1.5, 0.5) cr.line_to (1.5, 0.5)
cr.line_to (-1.5, 0.5) cr.line_to (-1.5, 0.5)
cr.line_to (-1.5, -0.5) cr.line_to (-1.5, -0.5)
cr.stroke ()
-- The contacts -- The terminals
cr.move_to (-2, 0) cr.move_to (-2, 0)
cr.line_to (-1.5, 0) cr.line_to (-1.5, 0)
cr.stroke ()
cr.move_to (1.5, 0) cr.move_to (1.5, 0)
cr.line_to (2, 0) cr.line_to (2, 0)
cr.stroke () cr.stroke ()
end end
local render_adj = function (cr)
render (cr)
-- The arrow
cr.move_to (-1, 1)
cr.line_to (1, -1)
cr.stroke ()
cr.save ()
cr.translate (1.5, -1.5)
cr.rotate (math.atan2 (1, 1))
cr.move_to (0, 0)
cr.line_to (0.3, 0.8)
cr.line_to (-0.3, 0.8)
cr.close_path ()
cr.fill ()
cr.restore ()
end
local render_pot = function (cr)
render (cr)
-- The contact
cr.move_to (0, -2)
cr.line_to (2, -2)
-- The arrow
cr.move_to (0, -2)
cr.line_to (0, -1)
cr.stroke ()
cr.move_to (0, -0.5)
cr.line_to (0.3, -1.3)
cr.line_to (-0.3, -1.3)
cr.close_path ()
cr.fill ()
end
-- Register the symbol -- Register the symbol
logdiag.register ("Resistor", names, area, terminals, render) logdiag.register ("Resistor",
names, area, terminals, render)
logdiag.register ("ResistorAdjustable",
names_adj, area_adj, terminals, render_adj)
logdiag.register ("Potentiometer",
names_pot, area_pot, terminals_pot, render_pot)

View File

@@ -3,6 +3,9 @@ Type=Application
Name=logdiag Name=logdiag
GenericName=Schematic Editor GenericName=Schematic Editor
GenericName[cs]=Editor schémat GenericName[cs]=Editor schémat
GenericName[sk]=Editor schém
GenericName[pl]=Edytor schematów
GenericName[de]=Schema Editor
Icon=logdiag Icon=logdiag
Exec=logdiag %f Exec=logdiag %f
MimeType=application/x-logdiag-diagram; MimeType=application/x-logdiag-diagram;

View File

@@ -32,8 +32,8 @@ struct _LdWindowMainPrivate
LdDiagram *diagram; LdDiagram *diagram;
gchar *filename; gchar *filename;
GtkWidget *canvas_window; GtkWidget *scrolled_window;
LdCanvas *canvas; LdDiagramView *view;
GtkWidget *statusbar; GtkWidget *statusbar;
guint statusbar_symbol_context_id; guint statusbar_symbol_context_id;
@@ -59,7 +59,7 @@ static void update_title (LdWindowMain *self);
static void action_set_sensitive (LdWindowMain *self, const gchar *name, static void action_set_sensitive (LdWindowMain *self, const gchar *name,
gboolean sensitive); gboolean sensitive);
static void on_canvas_zoom_changed (LdCanvas *canvas, static void on_view_zoom_changed (LdDiagramView *view,
GParamSpec *pspec, LdWindowMain *self); GParamSpec *pspec, LdWindowMain *self);
static void on_diagram_changed (LdDiagram *diagram, LdWindowMain *self); static void on_diagram_changed (LdDiagram *diagram, LdWindowMain *self);
@@ -71,6 +71,7 @@ static void on_diagram_selection_changed (LdDiagram *diagram,
static gchar *diagram_get_name (LdWindowMain *self); static gchar *diagram_get_name (LdWindowMain *self);
static void diagram_set_filename (LdWindowMain *self, gchar *filename); static void diagram_set_filename (LdWindowMain *self, gchar *filename);
static void diagram_new (LdWindowMain *self); static void diagram_new (LdWindowMain *self);
static gboolean diagram_open (LdWindowMain *self, const gchar *filename);
static void diagram_save (LdWindowMain *self); static void diagram_save (LdWindowMain *self);
static GtkFileFilter *diagram_get_file_filter (void); static GtkFileFilter *diagram_get_file_filter (void);
@@ -100,6 +101,12 @@ static void on_action_redo (GtkAction *action, LdWindowMain *self);
static void on_action_delete (GtkAction *action, LdWindowMain *self); static void on_action_delete (GtkAction *action, LdWindowMain *self);
static void on_action_select_all (GtkAction *action, LdWindowMain *self); static void on_action_select_all (GtkAction *action, LdWindowMain *self);
static void on_action_main_toolbar (GtkToggleAction *action,
LdWindowMain *self);
static void on_action_library_toolbar (GtkToggleAction *action,
LdWindowMain *self);
static void on_action_grid (GtkToggleAction *action, LdWindowMain *self);
static void on_action_zoom_in (GtkAction *action, LdWindowMain *self); static void on_action_zoom_in (GtkAction *action, LdWindowMain *self);
static void on_action_zoom_out (GtkAction *action, LdWindowMain *self); static void on_action_zoom_out (GtkAction *action, LdWindowMain *self);
static void on_action_normal_size (GtkAction *action, LdWindowMain *self); static void on_action_normal_size (GtkAction *action, LdWindowMain *self);
@@ -110,76 +117,96 @@ static void on_action_normal_size (GtkAction *action, LdWindowMain *self);
/* Actions for menus, toolbars, accelerators. */ /* Actions for menus, toolbars, accelerators. */
static GtkActionEntry wm_action_entries[] = static GtkActionEntry wm_action_entries[] =
{ {
{"FileMenu", NULL, Q_("_File"), NULL, NULL, NULL}, {"FileMenu", NULL, N_("_File"), NULL, NULL, NULL},
{"New", GTK_STOCK_NEW, Q_("_New"), "<Ctrl>N", {"New", GTK_STOCK_NEW, N_("_New"), "<Ctrl>N",
Q_("Create a new diagram"), N_("Create a new diagram"),
G_CALLBACK (on_action_new)}, G_CALLBACK (on_action_new)},
{"Open", GTK_STOCK_OPEN, Q_("_Open..."), "<Ctrl>O", {"Open", GTK_STOCK_OPEN, N_("_Open..."), "<Ctrl>O",
Q_("Open a diagram"), N_("Open a diagram"),
G_CALLBACK (on_action_open)}, G_CALLBACK (on_action_open)},
{"Save", GTK_STOCK_SAVE, Q_("_Save"), "<Ctrl>S", {"Save", GTK_STOCK_SAVE, N_("_Save"), "<Ctrl>S",
Q_("Save the current diagram"), N_("Save the current diagram"),
G_CALLBACK (on_action_save)}, G_CALLBACK (on_action_save)},
{"SaveAs", GTK_STOCK_SAVE_AS, Q_("Save _As..."), "<Shift><Ctrl>S", {"SaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<Shift><Ctrl>S",
Q_("Save the current diagram with another name"), N_("Save the current diagram with another name"),
G_CALLBACK (on_action_save_as)}, G_CALLBACK (on_action_save_as)},
/* /*
* {"Export", NULL, Q_("_Export"), NULL, * {"Export", NULL, N_("_Export"), NULL,
* Q_("Export the diagram"), * N_("Export the diagram"),
* NULL}, * NULL},
*/ */
{"Quit", GTK_STOCK_QUIT, Q_("_Quit"), "<Ctrl>Q", {"Quit", GTK_STOCK_QUIT, N_("_Quit"), "<Ctrl>Q",
Q_("Quit the application"), N_("Quit the application"),
G_CALLBACK (on_action_quit)}, G_CALLBACK (on_action_quit)},
{"EditMenu", NULL, Q_("_Edit"), NULL, NULL, NULL}, {"EditMenu", NULL, N_("_Edit"), NULL, NULL, NULL},
{"Undo", GTK_STOCK_UNDO, Q_("_Undo"), "<Ctrl>Z", {"Undo", GTK_STOCK_UNDO, N_("_Undo"), "<Ctrl>Z",
Q_("Undo the last action"), N_("Undo the last action"),
G_CALLBACK (on_action_undo)}, G_CALLBACK (on_action_undo)},
{"Redo", GTK_STOCK_REDO, Q_("_Redo"), "<Shift><Ctrl>Z", {"Redo", GTK_STOCK_REDO, N_("_Redo"), "<Shift><Ctrl>Z",
Q_("Redo the last undone action"), N_("Redo the last undone action"),
G_CALLBACK (on_action_redo)}, G_CALLBACK (on_action_redo)},
/* /*
* {"Cut", GTK_STOCK_CUT, Q_("Cu_t"), "<Ctrl>X", NULL, NULL}, * {"Cut", GTK_STOCK_CUT, N_("Cu_t"), "<Ctrl>X", NULL, NULL},
* {"Copy", GTK_STOCK_COPY, Q_("_Copy"), "<Ctrl>C", NULL, NULL}, * {"Copy", GTK_STOCK_COPY, N_("_Copy"), "<Ctrl>C", NULL, NULL},
* {"Paste", GTK_STOCK_PASTE, Q_("_Paste"), "<Ctrl>V", NULL, NULL}, * {"Paste", GTK_STOCK_PASTE, N_("_Paste"), "<Ctrl>V", NULL, NULL},
*/ */
{"Delete", GTK_STOCK_DELETE, Q_("_Delete"), "Delete", {"Delete", GTK_STOCK_DELETE, N_("_Delete"), "Delete",
Q_("Delete the contents of the selection"), N_("Delete the contents of the selection"),
G_CALLBACK (on_action_delete)}, G_CALLBACK (on_action_delete)},
{"SelectAll", GTK_STOCK_SELECT_ALL, Q_("Select _All"), "<Ctrl>A", {"SelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "<Ctrl>A",
Q_("Select all objects in the diagram"), N_("Select all objects in the diagram"),
G_CALLBACK (on_action_select_all)}, G_CALLBACK (on_action_select_all)},
{"ViewMenu", NULL, Q_("_View"), NULL, NULL, NULL}, {"ViewMenu", NULL, N_("_View"), NULL, NULL, NULL},
{"ZoomIn", GTK_STOCK_ZOOM_IN, Q_("_Zoom In"), "<Ctrl>plus", {"ZoomIn", GTK_STOCK_ZOOM_IN, N_("_Zoom In"), "<Ctrl>plus",
Q_("Zoom into the diagram"), N_("Zoom into the diagram"),
G_CALLBACK (on_action_zoom_in)}, G_CALLBACK (on_action_zoom_in)},
{"ZoomOut", GTK_STOCK_ZOOM_OUT, Q_("Zoom _Out"), "<Ctrl>minus", {"ZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "<Ctrl>minus",
Q_("Zoom out of the diagram"), N_("Zoom out of the diagram"),
G_CALLBACK (on_action_zoom_out)}, G_CALLBACK (on_action_zoom_out)},
{"NormalSize", GTK_STOCK_ZOOM_100, Q_("_Normal Size"), "<Ctrl>0", {"NormalSize", GTK_STOCK_ZOOM_100, N_("_Normal Size"), "<Ctrl>0",
Q_("Reset zoom level back to the default"), N_("Reset zoom level back to the default"),
G_CALLBACK (on_action_normal_size)}, G_CALLBACK (on_action_normal_size)},
{"HelpMenu", NULL, Q_("_Help"), NULL, NULL, NULL}, {"HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL},
{"About", GTK_STOCK_ABOUT, Q_("_About"), NULL, {"About", GTK_STOCK_ABOUT, N_("_About"), NULL,
Q_("Show a dialog about this application"), N_("Show a dialog about this application"),
G_CALLBACK (on_action_about)} G_CALLBACK (on_action_about)}
}; };
static GtkToggleActionEntry wm_toggle_action_entries[] =
{
{"MainToolbar", NULL, N_("_Main Toolbar"), NULL,
N_("Toggle displaying of the main toolbar"),
G_CALLBACK (on_action_main_toolbar), TRUE},
{"LibraryToolbar", NULL, N_("_Library Toolbar"), NULL,
N_("Toggle displaying of the library toolbar"),
G_CALLBACK (on_action_library_toolbar), TRUE},
{"ShowGrid", NULL, N_("Show _Grid"), NULL,
N_("Toggle displaying of the grid"),
G_CALLBACK (on_action_grid), TRUE}
};
/* ===== Generic widget methods ============================================ */ /* ===== Generic widget methods ============================================ */
/** /**
* ld_window_main_new: * ld_window_main_new:
* @filename: (allow-none): a file to open.
* *
* Create an instance. * Create an instance.
*/ */
GtkWidget * GtkWidget *
ld_window_main_new (void) ld_window_main_new (const gchar *filename)
{ {
return g_object_new (LD_TYPE_WINDOW_MAIN, NULL); GtkWidget *self;
self = g_object_new (LD_TYPE_WINDOW_MAIN, NULL);
if (filename)
diagram_open (LD_WINDOW_MAIN (self), filename);
return self;
} }
G_DEFINE_TYPE (LdWindowMain, ld_window_main, GTK_TYPE_WINDOW); G_DEFINE_TYPE (LdWindowMain, ld_window_main, GTK_TYPE_WINDOW);
@@ -216,8 +243,14 @@ ld_window_main_init (LdWindowMain *self)
G_CALLBACK (on_ui_proxy_disconnected), self); G_CALLBACK (on_ui_proxy_disconnected), self);
priv->action_group = gtk_action_group_new ("MainActions"); priv->action_group = gtk_action_group_new ("MainActions");
gtk_action_group_add_actions (priv->action_group, wm_action_entries, gtk_action_group_set_translation_domain
(priv->action_group, GETTEXT_DOMAIN);
gtk_action_group_add_actions
(priv->action_group, wm_action_entries,
G_N_ELEMENTS (wm_action_entries), self); G_N_ELEMENTS (wm_action_entries), self);
gtk_action_group_add_toggle_actions
(priv->action_group, wm_toggle_action_entries,
G_N_ELEMENTS (wm_toggle_action_entries), self);
gtk_ui_manager_insert_action_group (priv->ui_manager, gtk_ui_manager_insert_action_group (priv->ui_manager,
priv->action_group, 0); priv->action_group, 0);
@@ -226,7 +259,7 @@ ld_window_main_init (LdWindowMain *self)
(priv->ui_manager, PROJECT_SHARE_DIR "gui/window-main.ui", &error); (priv->ui_manager, PROJECT_SHARE_DIR "gui/window-main.ui", &error);
if (error) if (error)
{ {
g_message (_("Building UI failed: %s"), error->message); g_message ("building UI failed: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@@ -239,10 +272,12 @@ ld_window_main_init (LdWindowMain *self)
gtk_toolbar_set_orientation (GTK_TOOLBAR (priv->library_toolbar), gtk_toolbar_set_orientation (GTK_TOOLBAR (priv->library_toolbar),
GTK_ORIENTATION_VERTICAL); GTK_ORIENTATION_VERTICAL);
priv->canvas = LD_CANVAS (ld_canvas_new ()); priv->view = LD_DIAGRAM_VIEW (ld_diagram_view_new ());
priv->canvas_window = gtk_scrolled_window_new (NULL, NULL); priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (priv->canvas_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
GTK_WIDGET (priv->canvas)); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (priv->scrolled_window),
GTK_WIDGET (priv->view));
priv->statusbar = gtk_statusbar_new (); priv->statusbar = gtk_statusbar_new ();
priv->statusbar_menu_context_id = gtk_statusbar_get_context_id priv->statusbar_menu_context_id = gtk_statusbar_get_context_id
@@ -254,7 +289,7 @@ ld_window_main_init (LdWindowMain *self)
priv->hbox = gtk_hbox_new (FALSE, 0); priv->hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->library_toolbar, gtk_box_pack_start (GTK_BOX (priv->hbox), priv->library_toolbar,
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->canvas_window, gtk_box_pack_start (GTK_BOX (priv->hbox), priv->scrolled_window,
TRUE, TRUE, 0); TRUE, TRUE, 0);
priv->vbox = gtk_vbox_new (FALSE, 0); priv->vbox = gtk_vbox_new (FALSE, 0);
@@ -289,16 +324,16 @@ ld_window_main_init (LdWindowMain *self)
priv->library = ld_library_new (); priv->library = ld_library_new ();
ld_library_load (priv->library, PROJECT_SHARE_DIR "library"); ld_library_load (priv->library, PROJECT_SHARE_DIR "library");
ld_canvas_set_diagram (priv->canvas, priv->diagram); ld_diagram_view_set_diagram (priv->view, priv->diagram);
ld_canvas_set_library (priv->canvas, priv->library); ld_diagram_view_set_library (priv->view, priv->library);
g_signal_connect (priv->canvas, "notify::zoom", g_signal_connect (priv->view, "notify::zoom",
G_CALLBACK (on_canvas_zoom_changed), self); G_CALLBACK (on_view_zoom_changed), self);
ld_library_toolbar_set_library (LD_LIBRARY_TOOLBAR (priv->library_toolbar), ld_library_toolbar_set_library (LD_LIBRARY_TOOLBAR (priv->library_toolbar),
priv->library); priv->library);
ld_library_toolbar_set_canvas (LD_LIBRARY_TOOLBAR (priv->library_toolbar), ld_library_toolbar_set_view (LD_LIBRARY_TOOLBAR (priv->library_toolbar),
priv->canvas); priv->view);
g_signal_connect_after (priv->library_toolbar, "symbol-selected", g_signal_connect_after (priv->library_toolbar, "symbol-selected",
G_CALLBACK (on_symbol_selected), self); G_CALLBACK (on_symbol_selected), self);
@@ -314,7 +349,7 @@ ld_window_main_init (LdWindowMain *self)
action_set_sensitive (self, "Delete", FALSE); action_set_sensitive (self, "Delete", FALSE);
action_set_sensitive (self, "NormalSize", FALSE); action_set_sensitive (self, "NormalSize", FALSE);
gtk_widget_grab_focus (GTK_WIDGET (priv->canvas)); gtk_widget_grab_focus (GTK_WIDGET (priv->view));
/* Realize the window. */ /* Realize the window. */
gtk_widget_show_all (GTK_WIDGET (self)); gtk_widget_show_all (GTK_WIDGET (self));
@@ -485,7 +520,7 @@ diagram_get_name (LdWindowMain *self)
g_return_val_if_fail (LD_IS_WINDOW_MAIN (self), NULL); g_return_val_if_fail (LD_IS_WINDOW_MAIN (self), NULL);
if (self->priv->filename) if (self->priv->filename)
return g_path_get_basename (self->priv->filename); return g_filename_display_basename (self->priv->filename);
else else
return g_strdup (_("Unsaved Diagram")); return g_strdup (_("Unsaved Diagram"));
} }
@@ -519,15 +554,16 @@ diagram_new (LdWindowMain *self)
{ {
g_return_if_fail (LD_IS_WINDOW_MAIN (self)); g_return_if_fail (LD_IS_WINDOW_MAIN (self));
if (!may_close_diagram (self, "Save the changes to diagram \"%s\" before" if (!may_close_diagram (self, _("Save the changes to diagram \"%s\" before"
" closing it and creating a new one?")) " closing it and creating a new one?")))
return; return;
ld_diagram_clear (self->priv->diagram); ld_diagram_clear (self->priv->diagram);
ld_diagram_set_modified (self->priv->diagram, FALSE); ld_diagram_set_modified (self->priv->diagram, FALSE);
/* TODO: Reset canvas view to the center. */ ld_diagram_view_set_x (self->priv->view, 0);
ld_canvas_set_zoom (self->priv->canvas, 1); ld_diagram_view_set_y (self->priv->view, 0);
ld_diagram_view_set_zoom (self->priv->view, 1);
diagram_set_filename (self, NULL); diagram_set_filename (self, NULL);
} }
@@ -563,10 +599,10 @@ diagram_save (LdWindowMain *self)
message_dialog = gtk_message_dialog_new (GTK_WINDOW (self), message_dialog = gtk_message_dialog_new (GTK_WINDOW (self),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
"Failed to save the diagram"); _("Failed to save the diagram"));
gtk_message_dialog_format_secondary_text gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG (message_dialog), (GTK_MESSAGE_DIALOG (message_dialog),
"Try again or save it under another name."); _("Try again or save it under another name."));
gtk_dialog_run (GTK_DIALOG (message_dialog)); gtk_dialog_run (GTK_DIALOG (message_dialog));
gtk_widget_destroy (message_dialog); gtk_widget_destroy (message_dialog);
} }
@@ -577,6 +613,41 @@ diagram_save (LdWindowMain *self)
} }
} }
/*
* diagram_open:
*
* Open a diagram from a file.
*/
static gboolean
diagram_open (LdWindowMain *self, const gchar *filename)
{
GError *error;
error = NULL;
ld_diagram_load_from_file (self->priv->diagram, filename, &error);
if (error)
{
GtkWidget *message_dialog;
g_warning ("loading failed: %s", error->message);
g_error_free (error);
message_dialog = gtk_message_dialog_new (GTK_WINDOW (self),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
_("Failed to open the file"));
gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG (message_dialog),
_("The file is probably corrupted."));
gtk_dialog_run (GTK_DIALOG (message_dialog));
gtk_widget_destroy (message_dialog);
return FALSE;
}
ld_diagram_set_modified (self->priv->diagram, FALSE);
diagram_set_filename (self, g_strdup (filename));
return TRUE;
}
/* /*
* diagram_get_file_filter: * diagram_get_file_filter:
* *
@@ -588,7 +659,7 @@ diagram_get_file_filter (void)
GtkFileFilter *filter; GtkFileFilter *filter;
filter = gtk_file_filter_new (); filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, "Logdiag Diagrams"); gtk_file_filter_set_name (filter, _("Logdiag Diagrams (*.ldd)"));
gtk_file_filter_add_pattern (filter, "*.ldd"); gtk_file_filter_add_pattern (filter, "*.ldd");
return filter; return filter;
} }
@@ -605,11 +676,11 @@ diagram_show_open_dialog (LdWindowMain *self)
g_return_if_fail (LD_IS_WINDOW_MAIN (self)); g_return_if_fail (LD_IS_WINDOW_MAIN (self));
if (!may_close_diagram (self, "Save the changes to diagram \"%s\" before" if (!may_close_diagram (self, _("Save the changes to diagram \"%s\" before"
" closing it and opening another one?")) " closing it and opening another one?")))
return; return;
dialog = gtk_file_chooser_dialog_new ("Open...", GTK_WINDOW (self), dialog = gtk_file_chooser_dialog_new (_("Open..."), GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
@@ -620,33 +691,10 @@ diagram_show_open_dialog (LdWindowMain *self)
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
gchar *filename; gchar *filename;
GError *error;
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
diagram_open (self, filename);
error = NULL; g_free (filename);
ld_diagram_load_from_file (self->priv->diagram, filename, &error);
if (error)
{
GtkWidget *message_dialog;
g_warning ("loading failed: %s", error->message);
g_error_free (error);
message_dialog = gtk_message_dialog_new (GTK_WINDOW (self),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
"Failed to open the file");
gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG (message_dialog),
"The file is probably corrupted.");
gtk_dialog_run (GTK_DIALOG (message_dialog));
gtk_widget_destroy (message_dialog);
}
else
{
ld_diagram_set_modified (self->priv->diagram, FALSE);
diagram_set_filename (self, filename);
}
} }
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }
@@ -663,7 +711,7 @@ diagram_show_save_as_dialog (LdWindowMain *self)
g_return_if_fail (LD_IS_WINDOW_MAIN (self)); g_return_if_fail (LD_IS_WINDOW_MAIN (self));
dialog = gtk_file_chooser_dialog_new ("Save As...", GTK_WINDOW (self), dialog = gtk_file_chooser_dialog_new (_("Save As..."), GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
@@ -674,8 +722,8 @@ diagram_show_save_as_dialog (LdWindowMain *self)
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
diagram_set_filename (self, gtk_file_chooser_get_filename diagram_set_filename (self,
(GTK_FILE_CHOOSER (dialog))); gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)));
diagram_save (self); diagram_save (self);
} }
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
@@ -716,9 +764,9 @@ may_close_diagram (LdWindowMain *self, const gchar *dialog_message)
dialog_message, name); dialog_message, name);
gtk_message_dialog_format_secondary_text gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG (message_dialog), (GTK_MESSAGE_DIALOG (message_dialog),
"If you don't save, changes will be permanently lost."); _("If you don't save, changes will be permanently lost."));
gtk_dialog_add_buttons (GTK_DIALOG (message_dialog), gtk_dialog_add_buttons (GTK_DIALOG (message_dialog),
"Close _without Saving", GTK_RESPONSE_NO, _("Close _without Saving"), GTK_RESPONSE_NO,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_YES, GTK_STOCK_SAVE, GTK_RESPONSE_YES,
NULL); NULL);
@@ -756,7 +804,7 @@ may_quit (LdWindowMain *self)
g_return_val_if_fail (LD_IS_WINDOW_MAIN (self), TRUE); g_return_val_if_fail (LD_IS_WINDOW_MAIN (self), TRUE);
return may_close_diagram (self, return may_close_diagram (self,
"Save the changes to diagram \"%s\" before closing?"); _("Save the changes to diagram \"%s\" before closing?"));
} }
@@ -790,19 +838,20 @@ on_symbol_chosen (LdLibraryToolbar *toolbar, LdSymbol *symbol,
diagram_symbol = ld_diagram_symbol_new (NULL); diagram_symbol = ld_diagram_symbol_new (NULL);
ld_diagram_symbol_set_class (diagram_symbol, klass); ld_diagram_symbol_set_class (diagram_symbol, klass);
ld_canvas_add_object_begin (self->priv->canvas, ld_diagram_view_add_object_begin (self->priv->view,
LD_DIAGRAM_OBJECT (diagram_symbol)); LD_DIAGRAM_OBJECT (diagram_symbol));
} }
static void static void
on_canvas_zoom_changed (LdCanvas *canvas, GParamSpec *pspec, LdWindowMain *self) on_view_zoom_changed (LdDiagramView *view, GParamSpec *pspec,
LdWindowMain *self)
{ {
action_set_sensitive (self, "ZoomIn", action_set_sensitive (self, "ZoomIn",
ld_canvas_can_zoom_in (self->priv->canvas)); ld_diagram_view_can_zoom_in (self->priv->view));
action_set_sensitive (self, "ZoomOut", action_set_sensitive (self, "ZoomOut",
ld_canvas_can_zoom_out (self->priv->canvas)); ld_diagram_view_can_zoom_out (self->priv->view));
action_set_sensitive (self, "NormalSize", action_set_sensitive (self, "NormalSize",
ld_canvas_get_zoom (self->priv->canvas) != 1); ld_diagram_view_get_zoom (self->priv->view) != 1);
} }
static void static void
@@ -842,6 +891,7 @@ on_action_about (GtkAction *action, LdWindowMain *self)
gtk_show_about_dialog (GTK_WINDOW (self), gtk_show_about_dialog (GTK_WINDOW (self),
"program-name", PROJECT_NAME, "program-name", PROJECT_NAME,
"version", PROJECT_VERSION, "version", PROJECT_VERSION,
"translator-credits", _("translator-credits"),
"copyright", "Copyright Přemysl Janouch 2010 - 2011", "copyright", "Copyright Přemysl Janouch 2010 - 2011",
"website", PROJECT_URL, "website", PROJECT_URL,
NULL); NULL);
@@ -871,20 +921,41 @@ on_action_select_all (GtkAction *action, LdWindowMain *self)
ld_diagram_select_all (self->priv->diagram); ld_diagram_select_all (self->priv->diagram);
} }
static void
on_action_main_toolbar (GtkToggleAction *action, LdWindowMain *self)
{
gtk_widget_set_visible (self->priv->toolbar,
gtk_toggle_action_get_active (action));
}
static void
on_action_library_toolbar (GtkToggleAction *action, LdWindowMain *self)
{
gtk_widget_set_visible (self->priv->library_toolbar,
gtk_toggle_action_get_active (action));
}
static void
on_action_grid (GtkToggleAction *action, LdWindowMain *self)
{
ld_diagram_view_set_show_grid (self->priv->view,
gtk_toggle_action_get_active (action));
}
static void static void
on_action_zoom_in (GtkAction *action, LdWindowMain *self) on_action_zoom_in (GtkAction *action, LdWindowMain *self)
{ {
ld_canvas_zoom_in (self->priv->canvas); ld_diagram_view_zoom_in (self->priv->view);
} }
static void static void
on_action_zoom_out (GtkAction *action, LdWindowMain *self) on_action_zoom_out (GtkAction *action, LdWindowMain *self)
{ {
ld_canvas_zoom_out (self->priv->canvas); ld_diagram_view_zoom_out (self->priv->view);
} }
static void static void
on_action_normal_size (GtkAction *action, LdWindowMain *self) on_action_normal_size (GtkAction *action, LdWindowMain *self)
{ {
ld_canvas_set_zoom (self->priv->canvas, 1); ld_diagram_view_set_zoom (self->priv->view, 1);
} }

View File

@@ -47,7 +47,7 @@ struct _LdWindowMainClass
GType ld_window_main_get_type (void) G_GNUC_CONST; GType ld_window_main_get_type (void) G_GNUC_CONST;
GtkWidget *ld_window_main_new (void); GtkWidget *ld_window_main_new (const gchar *filename);
G_END_DECLS G_END_DECLS

View File

@@ -9,6 +9,7 @@
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <locale.h>
#include "config.h" #include "config.h"
@@ -18,25 +19,63 @@
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
GtkWidget *wnd; GError *error;
#ifdef _WIN32
gchar *install_dir;
install_dir = g_win32_get_package_installation_directory_of_module (NULL);
if (install_dir)
{
g_chdir (install_dir);
g_free (install_dir);
}
#endif
#ifdef HAVE_GETTEXT
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_DOMAIN, GETTEXT_DIRNAME); bindtextdomain (GETTEXT_DOMAIN, GETTEXT_DIRNAME);
bind_textdomain_codeset (GETTEXT_DOMAIN, "UTF-8"); bind_textdomain_codeset (GETTEXT_DOMAIN, "UTF-8");
textdomain (GETTEXT_DOMAIN); textdomain (GETTEXT_DOMAIN);
#endif
/* For custom command line arguments, see: error = NULL;
* http://git.gnome.org/browse/glade3/tree/src/main.c gtk_init_with_args (&argc, &argv,
*/ N_("[FILE] - Schematic editor"), NULL, GETTEXT_DOMAIN, &error);
if (error)
{
g_warning ("%s", error->message);
g_error_free (error);
return 1;
}
gtk_init (&argc, &argv);
gtk_window_set_default_icon_name (PROJECT_NAME); gtk_window_set_default_icon_name (PROJECT_NAME);
wnd = ld_window_main_new ();
gtk_main ();
/* TODO: Accept multiple files. */
if (argc < 2)
ld_window_main_new (NULL);
else
{
gchar *arg_utf8, *arg_filename;
arg_utf8 = g_locale_to_utf8 (argv[1], -1, NULL, NULL, &error);
if (error)
{
g_warning ("%s", error->message);
g_error_free (error);
return 1;
}
arg_filename = g_filename_from_utf8 (arg_utf8, -1, NULL, NULL, &error);
if (error)
{
g_warning ("%s", error->message);
g_error_free (error);
return 1;
}
ld_window_main_new (arg_filename);
g_free (arg_filename);
g_free (arg_utf8);
}
gtk_main ();
return 0; return 0;
} }