19 Commits

Author SHA1 Message Date
b45670f9e9 CMakeLists.txt: simplify NSIS configuration
Functionality has been verified to remain as it was
on a native Windows XP build using NSIS 3.08.
2021-10-27 21:47:49 +02:00
06e3c9e280 Bind # to toggling the view grid
As seen in Inkscape.
2021-10-27 18:38:33 +02:00
073a4cd4a7 CMakeLists.txt: don't look for gtk-doc by default
The integration is broken and it spams with a warning message
when building on Windows directly.
2021-10-26 20:12:26 +02:00
f7807cada2 Make the about dialog link work in Windows XP
For some weird reason, GTK+ is trying to connect to URLs first,
which typically won't succeed these days.
2021-10-26 07:37:50 +02:00
08cf0ef2e6 Make development builds find the program icon 2021-10-26 06:32:29 +02:00
baf2dc8ccd Fix help on Windows with newer GIO
It needs its launch helper, luckily it's a tiny binary.
2021-10-25 23:12:14 +02:00
a5e341bcc1 Update README 2021-10-25 18:21:23 +02:00
bc8ceebef7 Add clang-format configuration, clean up 2021-10-25 18:06:50 +02:00
da0a5c43dc Add the user guide to the Help menu
The old GLib put up a good fight, it says "URIs not supported"
even for the file:// scheme.
2021-10-25 02:50:14 +02:00
384dad7bd8 Get rid of extra semicolons after macros 2021-10-25 00:27:32 +02:00
ada833a009 Abandon AsciiDoc in favor of plain HTML
It is very difficult to set up Python or Ruby on Windows XP.

Simple HTML works better, everywhere, it covers all our needs,
and it isn't any harder to write.

This documentation is now installed.
2021-10-25 00:04:28 +02:00
924617e1ce Silence some GLib deprecation warnings
Using the GLib version from the GTK+ 3.8.2 bundle.
2021-10-24 16:45:53 +02:00
67acddb26d Disable the broken gtk-doc rule by default
Unlikely to be used by anyone, especially since it cannot produce
anything useful anymore.
2021-10-24 16:43:55 +02:00
bc1dd64fdf Partially unbreak the hopeless gtk-doc
GNOME Idiots Inc. keep breaking everything,
sometimes in coöperation with KitWare KludgeMakers Ltd.
2021-10-24 15:31:03 +02:00
8c290df7b5 Update README 2021-10-23 20:27:51 +02:00
5fc35517cb Update README 2021-10-23 20:11:10 +02:00
5a4cffd35e Win32Depends.cmake: remove an unused feature 2021-10-23 20:02:45 +02:00
3a087ad581 Remove unnecessary DLLs from Windows builds
This saves 20 MiB and 4 MiB of libraries in MSYS2 and bundle
builds respectively, in total, without any adverse effects.

The MSYS2 build remains bloated, due to the Adwaita icon theme.

Bump minimum CMake version to avoid a bug.
2021-10-23 18:01:30 +02:00
4305c603e9 CMakeLists.txt: clean-up
Use the newer 3.0 string quoting to save some ugly escaping.
2021-10-23 16:35:36 +02:00
47 changed files with 754 additions and 568 deletions

37
.clang-format Normal file
View File

@@ -0,0 +1,37 @@
# clang-format is fairly limited, and these rules are approximate:
# - array initializers can get terribly mangled with clang-format 12.0,
# - sometimes it still aligns with space characters,
# - struct name NL { NL ... NL } NL name; is unachievable.
BasedOnStyle: GNU
ColumnLimit: 80
IndentWidth: 4
TabWidth: 4
UseTab: ForContinuationAndIndentation
BreakBeforeBraces: Allman
SpaceAfterCStyleCast: true
AlignConsecutiveAssignments: true
AlignAfterOpenBracket: DontAlign
AlignEscapedNewlines: DontAlign
AlignOperands: DontAlign
AlignConsecutiveMacros: Consecutive
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
Cpp11BracedListStyle: true
MaxEmptyLinesToKeep: 2
# IncludeCategories has some potential, but currently it breaks build.
# Note that the documentation says the value should be "Never".
SortIncludes: false
# Must be kept synchronized with gi18n.h and make-template.sh.
WhitespaceSensitiveMacros: ['_', 'Q_', 'N_', 'C_', 'NC_']
# This is a compromise, it generally works out aesthetically better.
BinPackArguments: false
# Unfortunately, this doesn't work for block comments, used in logdiag.
SpacesBeforeTrailingComments: 2
# logdiag-specific function body wrappers.
MacroBlockBegin: "LD_LUA_CAIRO_BEGIN"
MacroBlockEnd: "LD_LUA_CAIRO_END"

View File

@@ -1,10 +1,11 @@
# The last version with Windows XP support is 3.13, we want to keep that
cmake_minimum_required (VERSION 3.9)
cmake_minimum_required (VERSION 3.10)
project (logdiag VERSION 0.2.1 LANGUAGES C)
# Options
option (OPTION_USE_VERA "Use vera++ for source code style checks" OFF)
option (OPTION_NOINSTALL "Only for developers; work without installing" OFF)
option (OPTION_NOINSTALL "For developers only--work without installing" OFF)
option (OPTION_GTKDOC "For developers only--enable use of gtk-doc" OFF)
option (BUILD_TESTING "Build tests" OFF)
# Project information
@@ -103,10 +104,6 @@ foreach (file ${project_PO_FILES})
list (APPEND project_TRANSLATIONS "${translation}")
endforeach (file)
# Documentation--gtk-doc 1.25 is required
find_package (GtkDoc 1.25)
set (project_DOC_DIR "${PROJECT_BINARY_DIR}/liblogdiag")
# Project source files
set (liblogdiag_SOURCES
liblogdiag/ld-marshal.c
@@ -174,6 +171,8 @@ if (WIN32)
endif (WIN32)
# Generate a configure file
add_definitions (-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36)
add_definitions (-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36)
configure_file (${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_BINARY_DIR})
@@ -221,7 +220,7 @@ set (logdiag_LIBS ${GTK3_LIBRARIES} ${Lua_LIBRARIES} m)
if (WIN32)
find_package (LibIntl REQUIRED)
list (APPEND logdiag_LIBS ${LIBINTL_LIBRARIES})
list (APPEND logdiag_LIBS ${LIBINTL_LIBRARIES} shell32)
endif (WIN32)
# Build the library
@@ -249,14 +248,26 @@ if (BUILD_TESTING)
endif (BUILD_TESTING)
# Generate documentation
if (GTKDOC_FOUND)
# FIXME: not our bug but xml/gtkdocentities.ent cannot be passed
target_link_libraries (liblogdiag ${logdiag_LIBS})
if (OPTION_GTKDOC)
find_package (GtkDoc 1.25 REQUIRED)
set (project_DOC_DIR "${PROJECT_BINARY_DIR}/liblogdiag")
# Extracted LDFLAGS didn't contain -l in CMake 3.21.3 and gtk-doc 1.33.2,
# pass them explicitly and work around insanity; CMake still exits with
# an error and gtk-doc produces empty HTML documentation
string (REGEX REPLACE "(;)([^-])" "\\1-l\\2" xldflags "${logdiag_LIBS}")
set_target_properties (liblogdiag PROPERTIES LINK_LIBRARIES "")
# The "official" module wants an XML file I don't want to give it
file (WRITE ${PROJECT_BINARY_DIR}/liblogdiag-docs-dummy.xml "<book/>")
# XXX: not our bug but xml/gtkdocentities.ent cannot be passed
# XXX: this causes `make clean` to remove the entire build directory,
# because it marks CMAKE_CURRENT_BINARY_DIR as an output
gtk_doc_add_module (liblogdiag
SOURCE ${PROJECT_SOURCE_DIR}/liblogdiag
SUFFIXES c h
# The "official" module wants an XML file I don't want to give it
XML ${PROJECT_BINARY_DIR}/liblogdiag/liblogdiag-docs.xml
SUFFIXES c h LDFLAGS "-l${xldflags}"
XML ${PROJECT_BINARY_DIR}/liblogdiag-docs-dummy.xml
LIBRARIES liblogdiag)
endif ()
@@ -333,8 +344,7 @@ if (WIN32)
install (DIRECTORY
${WIN32_DEPENDS_PATH}/bin/
DESTINATION .
FILES_MATCHING PATTERN "*.dll"
PATTERN "libgettext*" EXCLUDE)
FILES_MATCHING PATTERN "*.dll" PATTERN "gspawn-*-helper.exe")
install (DIRECTORY
${WIN32_DEPENDS_PATH}/etc/
DESTINATION etc)
@@ -366,6 +376,8 @@ if (WIN32)
DESTINATION share/locale)
endif (translation_found GREATER -1)
endforeach (locale)
install (SCRIPT Win32Cleanup.cmake)
else (WIN32)
install (TARGETS logdiag DESTINATION bin)
install (FILES share/logdiag.desktop DESTINATION share/applications)
@@ -377,13 +389,14 @@ else (WIN32)
install (FILES LICENSE NEWS DESTINATION share/doc/${PROJECT_NAME})
endif (WIN32)
install (DIRECTORY docs/user-guide DESTINATION share/doc/${PROJECT_NAME})
install (DIRECTORY share/gui share/library DESTINATION share/${PROJECT_NAME})
install (FILES ${GSETTINGS_SCHEMAS} DESTINATION share/glib-2.0/schemas)
install (CODE " # DESTDIR is not in use on Windows
install (CODE " # DESTDIR is not in use on Windows (WIN32 is only native here!)
if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")
execute_process (COMMAND \"${GLIB_COMPILE_SCHEMAS_EXECUTABLE}\"
\"\${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\")
endif (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")")
endif ()")
# CPack
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Schematic editor")
@@ -409,22 +422,21 @@ set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}")
set (CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/share\\\\header.bmp")
set (CPACK_NSIS_INSTALLED_ICON_NAME "logdiag.exe")
set (CPACK_NSIS_CREATE_ICONS_EXTRA "
CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\logdiag.lnk' '\$INSTDIR\\\\logdiag.exe'")
set (CPACK_NSIS_DELETE_ICONS_EXTRA "
Delete '\$SMPROGRAMS\\\\$MUI_TEMP\\\\logdiag.lnk'")
set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
set (CPACK_NSIS_URL_INFO_ABOUT "${project_URL}")
set (CPACK_NSIS_HELP_LINK "${project_URL}")
# Or CPACK_NSIS_EXECUTABLES_DIRECTORY needs to be changed from "bin"
set (CPACK_NSIS_MENU_LINKS "logdiag.exe" ${PROJECT_NAME})
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 "
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 "https://" "https:\\\\\\\\" project_URL_NSIS "${project_URL}")
set (CPACK_NSIS_URL_INFO_ABOUT "${project_URL_NSIS}")
System::Call 'shell32::SHChangeNotify(i,i,i,i) (0x08000000, 0x1000, 0, 0)'
]])
set (CPACK_DEBIAN_PACKAGE_DEPENDS
"libgtk3.0-0 (>= 3.8), libjson-glib-1.0-0 (>= 0.10.4), liblua5.2-0")
@@ -443,4 +455,3 @@ set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user;/win32-dep
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
include (CPack)

View File

@@ -3,7 +3,8 @@ logdiag
'logdiag' is a simple multiplatform schematic editor written in GTK+.
This software has never really been finished, and is no longer being worked on.
This software has never really been finished, and is no longer being worked on,
although I strive to keep it building on Windows XP and elsewhere.
image::docs/user-guide/logdiag-en.png[align="center"]
@@ -12,10 +13,13 @@ Packages
Regular releases are sporadic. git master should be stable enough. You can get
a package with the latest development version from Archlinux's AUR.
Windows installers can be downloaded from
https://git.janouch.name/p/logdiag/releases[the Releases page on Gitea].
Requirements
------------
Runtime dependencies: GTK+ >= 3.8, json-glib >= 0.10.4, lua >= 5.2 +
Build dependencies: CMake >= 3.9
Build dependencies: CMake >= 3.10
Build from source on Unix-like systems
--------------------------------------
@@ -32,49 +36,45 @@ application to be installed. The default is _/usr/local_.
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
Now you have two basic choices of installing the application.
Using _make install_
~~~~~~~~~~~~~~~~~~~~
Now you have two basic choices of installing the application:
1. Using _make install_:
+
# make install
Using _cpack_
~~~~~~~~~~~~~
2. Using _cpack_:
+
You have to choose a package format understood by your system package manager.
CMake offers DEB and RPM.
+
After _cpack_ finishes making the package, install this file.
+
$ cpack -G DEB
# dpkg -i logdiag-version-system-arch.deb
Build from source on Windows
----------------------------
_Note that with the current method we're stuck with GTK+ 3.8.2._
_Note that using the current method we're stuck with GTK+ 3.8.2, which works
worse on Windows 10, but better on XP and under WINE._
First install CMake and MinGW. Add both to your system path. If you want
to build an installation package, also install NSIS. If you want to build within
a path containing spaces, fix your FindPkgConfig.cmake to say:
First, install CMake and MinGW. Add both to your system path. If you want
to build an installation package, also install NSIS. If you want to build
within a path containing spaces,
https://gitlab.kitware.com/cmake/cmake/-/issues/22396[fix] your CMake's
FindPkgConfig.cmake module to say:
separate_arguments(_pkgconfig_invoke_result UNIX_COMMAND "${_pkgconfig_invoke_result}")
Run the following command in the directory with source files to automatically
fetch and setup all dependencies (contact me if the script becomes obsolete,
it's easy to fix but I usually update it only just a short while before
releasing a new version in order to resolve compatibility issues):
fetch and set up all dependencies (note that Windows XP is no longer able to
download from HTTPS sources, you'll have to run this externally):
> cmake -P Win32Depends.cmake
Note that Windows XP is no longer able to reliably download from HTTPS sources.
Reserve a directory for an out-of-source build:
Reserve a directory for an out-of-source build and let CMake prepare the 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:
@@ -97,9 +97,8 @@ Just install MinGW-w64 and let automation take care of the rest.
$ cmake -P Win32Depends.cmake
$ mkdir build
$ cd build
$ cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../ToolchainCrossMinGWW64.cmake \
-DCMAKE_BUILD_TYPE=Release
$ cmake -DCMAKE_TOOLCHAIN_FILE=../ToolchainCrossMinGWW64.cmake \
-DCMAKE_BUILD_TYPE=Release ..
$ cpack
Alternatively, for an unnecessarily bloated MSYS2-based 64-bit build:

37
Win32Cleanup.cmake Normal file
View File

@@ -0,0 +1,37 @@
# To be run from cmake_install.cmake, eradicates all unreferenced libraries.
# CMake 3.9.6 has a parsing bug with ENCODING UTF-8.
cmake_minimum_required (VERSION 3.10)
# CPack runs this almost without any CMake variables at all
# (cmStateSnapshot::SetDefaultDefinitions(), CMAKE_INSTALL_PREFIX, [DESTDIR])
set (installdir "${CMAKE_INSTALL_PREFIX}")
if (NOT installdir OR installdir MATCHES "^/usr(/|$)")
return ()
endif ()
# The function is recursive and CMake has tragic scoping behaviour;
# environment variables are truly global there, in the absence of a cache
unset (ENV{seen})
function (expand path)
set (seen $ENV{seen})
if (path IN_LIST seen OR NOT EXISTS "${path}")
return ()
endif ()
set (ENV{seen} "$ENV{seen};${path}")
file (STRINGS "${path}" strings REGEX "[.][Dd][Ll][Ll]$" ENCODING UTF-8)
foreach (string ${strings})
string (REGEX MATCH "[-.+_a-zA-Z0-9]+$" word "${string}")
expand ("${installdir}/${word}")
endforeach ()
endfunction ()
file (GLOB roots LIST_DIRECTORIES false "${installdir}/*.[Ee][Xx][Ee]"
"${installdir}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.[Dd][Ll][Ll]")
foreach (binary ${roots})
expand ("${binary}")
endforeach ()
file (GLOB libraries LIST_DIRECTORIES false "${installdir}/*.[Dd][Ll][Ll]")
list (REMOVE_ITEM libraries $ENV{seen})
file (REMOVE ${libraries})

View File

@@ -6,7 +6,6 @@ cmake_minimum_required (VERSION 3.9)
# Directories
set (working_dir ${CMAKE_CURRENT_BINARY_DIR}/win32-depends)
set (pkg_dir ${working_dir}/packages)
set (tmp_dir ${working_dir}/tmp)
file (MAKE_DIRECTORY ${working_dir})
file (MAKE_DIRECTORY ${pkg_dir})
@@ -93,23 +92,11 @@ foreach (pkg_set ${pkg_list})
foreach (url ${pkg_${pkg_set}_urls})
get_filename_component (filename ${url} NAME)
message (STATUS "Extracting ${filename}...")
set (extract_command ${CMAKE_COMMAND} -E tar xf)
set (filename ${pkg_dir}/${filename})
if (pkg_${pkg_set}_strip)
file (MAKE_DIRECTORY ${tmp_dir})
execute_process (COMMAND ${extract_command} ${filename}
WORKING_DIRECTORY ${tmp_dir}
RESULT_VARIABLE status)
file (COPY ${tmp_dir}/${pkg_${pkg_set}_strip}/
DESTINATION ${working_dir})
file (REMOVE_RECURSE ${tmp_dir})
else ()
execute_process (COMMAND ${extract_command} ${filename}
WORKING_DIRECTORY ${working_dir}
RESULT_VARIABLE status)
endif ()
execute_process (COMMAND ${CMAKE_COMMAND} -E tar xf ${filename}
WORKING_DIRECTORY ${working_dir}
RESULT_VARIABLE status)
if (status)
message (FATAL_ERROR "Extraction failed: ${status}")
endif ()

View File

@@ -16,11 +16,14 @@
#ifdef OPTION_NOINSTALL
/* For developers. */
#define PROJECT_DOC_DIR "${CMAKE_SOURCE_DIR}/docs/"
#define PROJECT_SHARE_DIR "${CMAKE_SOURCE_DIR}/share/"
#define PROJECT_GSETTINGS_DIR "${CMAKE_BINARY_DIR}"
#elif defined (_WIN32)
#define PROJECT_DOC_DIR "share/doc/${PROJECT_NAME}/"
#define PROJECT_SHARE_DIR "share/${PROJECT_NAME}/"
#else
#define PROJECT_DOC_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}/"
#define PROJECT_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/"
#endif

View File

@@ -0,0 +1,7 @@
body { max-width: 50em; margin: 0 auto 4em auto; padding: 0 2em;
font-family: sans-serif; } h1, h2, h3 { font-weight: normal; }
h1 { font-size: 2.5em; } h2 { font-size: 2em; } h3 { font-size: 1.33em; }
h2 { padding-top: .67em; border-top: 1px solid silver; }
p { line-height: 1.5; } .figure { text-align: center; } img { max-width: 100%; }
q { font-style: normal; } .details { border-bottom: 1px solid silver; }
.details br { display: none; } .details br + span:before { content: " — "; }

View File

@@ -1,148 +0,0 @@
// TODO: nakonfigurovat v CMake asciidoctor-pdf, je potřeba pár `gem install`
// https://github.com/asciidoctor/asciidoctor-pdf/blob/master/README.adoc
// https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc
logdiag: Průvodce uživatele
===========================
Přemysl Eric Janouch <p@janouch.name>
v0.2.0, 2018-06-27
:toc: left
:toc-title: Obsah
:sectnums:
:warning-caption: VAROVÁNÍ
:xrefstyle: short
:figure-caption: Obrázek
image::logdiag-cs.png[]
<<<
Ú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.
Získání aplikace
----------------
Nejnovější verzi aplikace je možné stáhnout na následující webové adrese:
https://git.janouch.name/p/logdiag.
[[gitea-download]]
.Nabídka pro stahování na stráncách projektu
image::gitea.png[]
Až se ocitnete na webu, vyhledejte v záhlaví záložku s nápisem ``Releases'' a
klepněte na ni. Zobrazí se přehled vydání a pod hlavičkami ``Downloads''
související soubory ke stažení. Instalační soubor pro Microsoft Windows nese
název ve stylu ``logdiag-__verze__-Windows-x86.exe''.
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.
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.
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.
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.
// XXX: nelze zarovnat obrázek na střed zároveň s caption
[[select-objects]]
.Výběr objektů v oblasti
image::select-objects.png[]
Alternativně můžete táhnout myší z volné oblasti diagramu do prostoru, viz
<<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.
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.
Odstranění objektů
~~~~~~~~~~~~~~~~~~
Objekty odstraníte stisknutím klávesy Delete, případně z menu aplikace.
Vložení značky
~~~~~~~~~~~~~~
_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 a přetažením
myší do diagramu na požadované umístění.
Otáčení značek
~~~~~~~~~~~~~~
Otočit značku vloženou do diagramu můžete přes pravé tlačítko myši.
Propojení terminálů
~~~~~~~~~~~~~~~~~~~
_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.
// XXX: nelze sloučit do jedné figure
[[create-connection]]
.Propojení terminálů dvou značek
image:create-connection-begin.png[]
&nbsp;...&nbsp;
image:create-connection-end.png[]
Časté problémy
--------------
Nelze otevřít uložený diagram
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Při ukládání se ujistěte, že zadaný název souboru obsahuje příponu ``.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.
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.
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.

View File

@@ -0,0 +1,141 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<title>logdiag: Průvodce uživatele</title>
<link rel="stylesheet" href="stylesheet.css">
<style>
q:lang(cs):before { content: "„"; }
q:lang(cs):after { content: "“"; }
</style>
</head>
<body>
<h1>logdiag: Průvodce uživatele</h1>
<p class="details">
<span id="author">Přemysl Eric Janouch</span><br>
<span id="email"><a href="mailto:p@janouch.name">p@janouch.name</a></span><br>
<span id="revnumber">verze 0.2.0,</span>
<span id="revdate">2018-06-27</span>
<p class="figure"><img src="logdiag-cs.png" alt="Okno programu logdiag">
<h2>Úvod</h2>
<p>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.
<h2>Získání aplikace</h2>
<p>Nejnovější verzi aplikace je možné stáhnout na následující webové adrese:
<a href="https://git.janouch.name/p/logdiag">https://git.janouch.name/p/logdiag</a>.
<p class="figure"><img src="gitea.png" alt="Gitea">
<br>Obrázek 1: Nabídka pro stahování na stránkách projektu
<p>Až se ocitnete na webu, vyhledejte v záhlaví záložku s nápisem
<q>Releases</q> a klepněte na ni. Zobrazí se přehled vydání a pod hlavičkami
<q>Downloads</q> související soubory ke stažení. Instalační soubor pro Microsoft
Windows nese název ve stylu <q>logdiag-<i>verze</i>-Windows-x86.exe</q>.
<h2>Instalace</h2>
<p>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.
<p><b>Pozor</b>: 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.
<h2>Operace s objekty</h2>
<p>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.
<!-- TODO: zkusit restrukturalizovat na:
Operace s objekty
Základní operace
Výběr
Přesun
Odstranění
Značky
Vložení
Otáčení
Spojení
Tvorba
-->
<h3>Výběr objektů</h3>
<p>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.
<p class="figure" id="select-objects">
<img src="select-objects.png" alt="Výběr objektů">
<br>Obrázek 2: Výběr objektů v oblasti
<p>Alternativně můžete táhnout myší z volné oblasti diagramu do prostoru, viz
<a href="#select-objects">Obrázek 2</a>. 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.
<h3>Přesun objektů</h3>
<p>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.
<h3>Odstranění objektů</h3>
<p>Objekty odstraníte stisknutím klávesy Delete, případně z menu aplikace.
<h3>Vložení značky</h3>
<p><i>Značky</i> 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
a přetažením myší do diagramu na požadované umístění.
<h3>Otáčení značek</h3>
<p>Otočit značku vloženou do diagramu můžete přes pravé tlačítko myši.
<h3>Propojení terminálů</h3>
<p><i>Terminálem</i> 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.
<p class="figure" id="create-connection">
<img src="create-connection-begin.png" alt="Začátek operace" align="center">
&nbsp;&#8230;&nbsp;
<img src="create-connection-end.png" alt="Konec operace" align="center">
<br>Obrázek 3: Propojení terminálů dvou značek
<h2>Časté problémy</h2>
<h3>Nelze otevřít uložený diagram</h3>
<p>Při ukládání se ujistěte, že zadaný název souboru obsahuje příponu
<q>.ldd</q>. 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.
<h3>Jak můžu diagram vytisknout?</h3>
<p>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.
<h3>Schází mi popisky</h3>
<p>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.
<script>
var toc = '', all = document.querySelectorAll('h2')
for (var i = 0; i < all.length; i++) {
var name = all[i].innerHTML.replace(/[^0-9a-z]/ig, '-')
toc += '<li><p><a href="#' + name + '">' + all[i].innerHTML + '</a></li>'
all[i].id = name
all[i].innerHTML = (i + 1) + '. ' + all[i].innerHTML
}
all[0].insertAdjacentHTML('beforebegin',
'<h2>Obsah</h2><ol>' + toc + '</ol>')
</script>

View File

@@ -1,146 +0,0 @@
// TODO: nakonfigurovat v CMake asciidoctor-pdf, je potřeba pár `gem install`
// https://github.com/asciidoctor/asciidoctor-pdf/blob/master/README.adoc
// https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc
logdiag: User Guide
===================
Přemysl Eric Janouch <p@janouch.name>
v0.2.0, 2018-06-27
:toc: left
:sectnums:
:xrefstyle: short
image::logdiag-en.png[]
<<<
Introduction
------------
This document will guide you through the application and help to familiarize you
with it. The description of tasks mainly targets the Microsoft Windows
operating system, though it's also valid for other operating systems to
a certain extent.
Getting the application
-----------------------
Download the newest version of the application at the following web address:
https://git.janouch.name/p/logdiag.
[[gitea-download]]
.The download menu on the project site
image::gitea.png[]
While on the web, look for a tab entitled ``Releases'' and click on it. A list
of versions will appear with files for download listed under ``Downloads''
headings. The installation file for Microsoft Windows is named in the style of
``logdiag-__version__-Windows-x86.exe''.
Installation
------------
The installation process is quite straight-forward. After the initial screen a
license agreement is required. Next, choose a folder in which to install the
application and another one for placement in the Start menu. So long as no
unexpected errors have occurred, all that's left is confirming a successful
installation.
WARNING: If the application is installed into 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.
Operations with objects
-----------------------
////
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
////
Each diagram consists of objects, and these are accompanied by the operations
described below. To cancel any current operation, press the Escape key.
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.
// XXX: nelze zarovnat obrázek na střed zároveň s caption
[[select-objects]]
.Selecting objects inside an area
image::select-objects.png[]
Alternatively drag the mouse from free space within the diagram into the area,
see <<select-objects>>. Objects contained in this rectangle will be
selected. The selection may later be dismissed by just clicking into free space.
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.
Removing objects
~~~~~~~~~~~~~~~~
Remove objects either by pressing the Delete key or from the application menu.
Inserting symbols
~~~~~~~~~~~~~~~~~
_Symbols_ constitute the most important kind of objects. Insert them into the
diagram by choosing one from the symbol menu located on the left side of the
main application window and dragging it onto the diagram where you want the
symbol to be placed.
Rotating symbols
~~~~~~~~~~~~~~~~
Rotate a symbol inserted into the diagram by right-clicking on it.
Connecting terminals
~~~~~~~~~~~~~~~~~~~~
A point intended for creation of connections between symbols or other
connections is called a _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.
// XXX: nelze sloučit do jedné figure
[[create-connection]]
.Interconnecting terminals of two symbols
image:create-connection-begin.png[]
&nbsp;...&nbsp;
image:create-connection-end.png[]
Frequent problems
-----------------
Can't open a saved diagram
~~~~~~~~~~~~~~~~~~~~~~~~~~
When saving, ensure that the filename you've typed in contains the ``.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.
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.
I miss labels
~~~~~~~~~~~~~
Similarly to the previous case, this functionality doesn't exist yet, but it is
possible to get around this limitation using a graphics editor.

View File

@@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>logdiag: User Guide</title>
<link rel="stylesheet" href="stylesheet.css">
<style>
q:lang(en):before { content: ""; }
q:lang(en):after { content: ""; }
</style>
</head>
<body>
<h1>logdiag: User Guide</h1>
<p class="details">
<span id="author">Přemysl Eric Janouch</span><br>
<span id="email"><a href="mailto:p@janouch.name">p@janouch.name</a></span><br>
<span id="revnumber">version 0.2.0,</span>
<span id="revdate">2018-06-27</span>
<p class="figure"><img src="logdiag-en.png" alt="logdiag program window">
<h2>Introduction</h2>
<p>This document will guide you through the application and help to familiarize
you with it. The description of tasks mainly targets the Microsoft Windows
operating system, though its also valid for other operating systems to
a certain extent.
<h2>Getting the application</h2>
<p>Download the newest version of the application at the following web address:
<a href="https://git.janouch.name/p/logdiag">https://git.janouch.name/p/logdiag</a>.
<p class="figure"><img src="gitea.png" alt="Gitea">
<br>Figure 1: The download menu on the project site
<p>While on the web, look for a tab entitled <q>Releases</q> and click on it.
A list of versions will appear with files for download listed under
<q>Downloads</q> headings. The installation file for Microsoft Windows is named
in the style of <q>logdiag-<i>version</i>-Windows-x86.exe</q>.
<h2>Installation</h2>
<p>The installation process is quite straight-forward. After the initial screen
a license agreement is required. Next, choose a folder in which to install
the application and another one for placement in the Start menu. So long as
no unexpected errors have occurred, all thats left is confirming a successful
installation.
<p><b>Warning</b>: If the application is installed into a folder where
a previous installation is already located, problems may arise. Although it is
possible to do so, dont 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.
<h2>Operations with objects</h2>
<p>Each diagram consists of objects, and these are accompanied by the operations
described below. To cancel any current operation, press the Escape key.
<!-- TODO: see the Czech version -->
<h3>Selecting objects</h3>
<p>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.
<p class="figure" id="select-objects">
<img src="select-objects.png" alt="select objects">
<br>Figure 2: Selecting objects inside an area
<p>Alternatively drag the mouse from free space within the diagram into
the area, see <a href="#select-objects">Figure 2</a>. Objects contained in this
rectangle will be selected. The selection may later be dismissed by just
clicking into free space.
<h3>Moving objects</h3>
<p>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.
<h3>Removing objects</h3>
<p>Remove objects either by pressing the Delete key or from the application
menu.
<h3>Inserting symbols</h3>
<p><i>Symbols</i> constitute the most important kind of objects. Insert them
into the diagram by choosing one from the symbol menu located on the left side
of the main application window and dragging it onto the diagram where you want
the symbol to be placed.
<h3>Rotating symbols</h3>
<p>Rotate a symbol inserted into the diagram by right-clicking on it.
<h3>Connecting terminals</h3>
<p>A point intended for creation of connections between symbols or other
connections is called a <i>terminal</i>. 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.
<p class="figure" id="create-connection">
<img src="create-connection-begin.png" alt="Start of operation" align="center">
&nbsp;&#8230;&nbsp;
<img src="create-connection-end.png" alt="End of operation" align="center">
<br>Figure 3: Interconnecting terminals of two symbols
<h2>Frequent problems</h2>
<h3>Cant open a saved diagram</h3>
<p>When saving, ensure that the filename youve typed in contains the
<q>.ldd</q> suffix. If not, it wont show up in the dialog for opening diagrams.
In case youve already saved a file without an extension, you may fix this
situation by adding the suffix to its name.
<h3>How do I print a diagram?</h3>
<p>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.
<h3>I miss labels</h3>
<p>Similarly to the previous case, this functionality doesnt exist yet, but it
is possible to get around this limitation using a graphics editor.
<script>
var toc = '', all = document.querySelectorAll('h2')
for (var i = 0; i < all.length; i++) {
var name = all[i].innerHTML.replace(/[^0-9a-z]/ig, '-')
toc += '<li><p><a href="#' + name + '">' + all[i].innerHTML + '</a></li>'
all[i].id = name
all[i].innerHTML = (i + 1) + '. ' + all[i].innerHTML
}
all[0].insertAdjacentHTML('beforebegin',
'<h2>Table of Contents</h2><ol>' + toc + '</ol>')
</script>

View File

@@ -456,9 +456,9 @@ on_leave_notify (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
}
static void
on_drag_data_get
(GtkWidget *widget, GdkDragContext *ctx, GtkSelectionData *selection_data,
guint target_type, guint time, gpointer user_data)
on_drag_data_get (GtkWidget *widget, GdkDragContext *ctx,
GtkSelectionData *selection_data, guint target_type, guint time,
gpointer user_data)
{
LdCategorySymbolView *self;

View File

@@ -15,16 +15,22 @@ G_BEGIN_DECLS
#define LD_TYPE_CATEGORY_SYMBOL_VIEW (ld_category_symbol_view_get_type ())
#define LD_CATEGORY_SYMBOL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_CATEGORY_SYMBOL_VIEW, LdCategorySymbolView))
#define LD_CATEGORY_SYMBOL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_CATEGORY_SYMBOL_VIEW, LdCategorySymbolViewClass))
#define LD_IS_CATEGORY_SYMBOL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_CATEGORY_SYMBOL_VIEW))
#define LD_IS_CATEGORY_SYMBOL_VIEW_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_CATEGORY_SYMBOL_VIEW))
#define LD_CATEGORY_SYMBOL_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_CATEGORY_SYMBOL_VIEW, LdCategorySymbolViewClass))
#define LD_CATEGORY_SYMBOL_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
LD_TYPE_CATEGORY_SYMBOL_VIEW, \
LdCategorySymbolView))
#define LD_CATEGORY_SYMBOL_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
LD_TYPE_CATEGORY_SYMBOL_VIEW, \
LdCategorySymbolViewClass))
#define LD_IS_CATEGORY_SYMBOL_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_CATEGORY_SYMBOL_VIEW))
#define LD_IS_CATEGORY_SYMBOL_VIEW_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_CATEGORY_SYMBOL_VIEW))
#define LD_CATEGORY_SYMBOL_VIEW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
LD_CATEGORY_SYMBOL_VIEW, \
LdCategorySymbolViewClass))
typedef struct _LdCategorySymbolView LdCategorySymbolView;
typedef struct _LdCategorySymbolViewPrivate LdCategorySymbolViewPrivate;

View File

@@ -58,7 +58,7 @@ ld_category_view_init (LdCategoryViewInterface *iface)
G_DEFINE_TYPE_WITH_CODE (LdCategoryTreeView,
ld_category_tree_view, GTK_TYPE_BOX,
G_IMPLEMENT_INTERFACE (LD_TYPE_CATEGORY_VIEW, ld_category_view_init));
G_IMPLEMENT_INTERFACE (LD_TYPE_CATEGORY_VIEW, ld_category_view_init))
static void
ld_category_tree_view_class_init (LdCategoryTreeViewClass *klass)

View File

@@ -15,16 +15,22 @@ G_BEGIN_DECLS
#define LD_TYPE_CATEGORY_TREE_VIEW (ld_category_tree_view_get_type ())
#define LD_CATEGORY_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_CATEGORY_TREE_VIEW, LdCategoryTreeView))
#define LD_CATEGORY_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_CATEGORY_TREE_VIEW, LdCategoryTreeViewClass))
#define LD_IS_CATEGORY_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_CATEGORY_TREE_VIEW))
#define LD_IS_CATEGORY_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_CATEGORY_TREE_VIEW))
#define LD_CATEGORY_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_CATEGORY_TREE_VIEW, LdCategoryTreeViewClass))
#define LD_CATEGORY_TREE_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
LD_TYPE_CATEGORY_TREE_VIEW, \
LdCategoryTreeView))
#define LD_CATEGORY_TREE_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
LD_TYPE_CATEGORY_TREE_VIEW, \
LdCategoryTreeViewClass))
#define LD_IS_CATEGORY_TREE_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_CATEGORY_TREE_VIEW))
#define LD_IS_CATEGORY_TREE_VIEW_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_CATEGORY_TREE_VIEW))
#define LD_CATEGORY_TREE_VIEW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
LD_CATEGORY_TREE_VIEW, \
LdCategoryTreeViewClass))
typedef struct _LdCategoryTreeView LdCategoryTreeView;
typedef struct _LdCategoryTreeViewPrivate LdCategoryTreeViewPrivate;

View File

@@ -21,7 +21,7 @@
* hierarchies.
*/
G_DEFINE_INTERFACE (LdCategoryView, ld_category_view, 0);
G_DEFINE_INTERFACE (LdCategoryView, ld_category_view, 0)
static void
ld_category_view_default_init (LdCategoryViewInterface *iface)
@@ -77,8 +77,7 @@ ld_category_view_default_init (LdCategoryViewInterface *iface)
* Assign an #LdCategory object to the view.
*/
void
ld_category_view_set_category (LdCategoryView *self,
LdCategory *category)
ld_category_view_set_category (LdCategoryView *self, LdCategory *category)
{
g_return_if_fail (LD_IS_CATEGORY_VIEW (self));
LD_CATEGORY_VIEW_GET_INTERFACE (self)->set_category (self, category);

View File

@@ -15,12 +15,14 @@ G_BEGIN_DECLS
#define LD_TYPE_CATEGORY_VIEW (ld_category_view_get_type ())
#define LD_CATEGORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_CATEGORY_VIEW, LdCategoryView))
#define LD_IS_CATEGORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_CATEGORY_VIEW))
#define LD_CATEGORY_VIEW_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE \
((inst), LD_TYPE_CATEGORY_VIEW, LdCategoryViewInterface))
#define LD_CATEGORY_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_CATEGORY_VIEW, LdCategoryView))
#define LD_IS_CATEGORY_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_CATEGORY_VIEW))
#define LD_CATEGORY_VIEW_GET_INTERFACE(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
LD_TYPE_CATEGORY_VIEW, \
LdCategoryViewInterface))
typedef struct _LdCategoryView LdCategoryView;
typedef struct _LdCategoryViewInterface LdCategoryViewInterface;
@@ -48,8 +50,7 @@ struct _LdCategoryViewInterface
GType ld_category_view_get_type (void) G_GNUC_CONST;
void ld_category_view_set_category (LdCategoryView *self,
LdCategory *category);
void ld_category_view_set_category (LdCategoryView *self, LdCategory *category);
LdCategory *ld_category_view_get_category (LdCategoryView *self);

View File

@@ -55,7 +55,7 @@ static void on_category_notify_name (LdCategory *category,
GParamSpec *pspec, gpointer user_data);
G_DEFINE_TYPE (LdCategory, ld_category, G_TYPE_OBJECT);
G_DEFINE_TYPE (LdCategory, ld_category, G_TYPE_OBJECT)
static void
ld_category_class_init (LdCategoryClass *klass)
@@ -561,4 +561,3 @@ ld_category_get_children (LdCategory *self)
g_return_val_if_fail (LD_IS_CATEGORY (self), NULL);
return self->priv->subcategories;
}

View File

@@ -15,16 +15,16 @@ G_BEGIN_DECLS
#define LD_TYPE_CATEGORY (ld_category_get_type ())
#define LD_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_CATEGORY, LdCategory))
#define LD_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_CATEGORY, LdCategoryClass))
#define LD_IS_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_CATEGORY))
#define LD_IS_CATEGORY_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_CATEGORY))
#define LD_CATEGORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_CATEGORY, LdCategoryClass))
#define LD_CATEGORY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_CATEGORY, LdCategory))
#define LD_CATEGORY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_CATEGORY, LdCategoryClass))
#define LD_IS_CATEGORY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_CATEGORY))
#define LD_IS_CATEGORY_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_CATEGORY))
#define LD_CATEGORY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_CATEGORY, LdCategoryClass))
typedef struct _LdCategory LdCategory;
typedef struct _LdCategoryPrivate LdCategoryPrivate;
@@ -77,4 +77,3 @@ const GSList *ld_category_get_children (LdCategory *self);
G_END_DECLS
#endif /* ! __LD_CATEGORY_H__ */

View File

@@ -57,7 +57,7 @@ static void on_set_points_destroy (gpointer user_data);
G_DEFINE_TYPE (LdDiagramConnection, ld_diagram_connection,
LD_TYPE_DIAGRAM_OBJECT);
LD_TYPE_DIAGRAM_OBJECT)
static void
ld_diagram_connection_class_init (LdDiagramConnectionClass *klass)
@@ -332,4 +332,3 @@ on_set_points_destroy (gpointer user_data)
json_node_free (data->new_node);
g_slice_free (SetPointsActionData, data);
}

View File

@@ -15,16 +15,22 @@ G_BEGIN_DECLS
#define LD_TYPE_DIAGRAM_CONNECTION (ld_diagram_connection_get_type ())
#define LD_DIAGRAM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_DIAGRAM_CONNECTION, LdDiagramConnection))
#define LD_DIAGRAM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_DIAGRAM_CONNECTION, LdDiagramConnectionClass))
#define LD_IS_DIAGRAM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_DIAGRAM_CONNECTION))
#define LD_IS_DIAGRAM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_DIAGRAM_CONNECTION))
#define LD_DIAGRAM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_DIAGRAM_CONNECTION, LdDiagramConnectionClass))
#define LD_DIAGRAM_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
LD_TYPE_DIAGRAM_CONNECTION, \
LdDiagramConnection))
#define LD_DIAGRAM_CONNECTION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
LD_TYPE_DIAGRAM_CONNECTION, \
LdDiagramConnectionClass))
#define LD_IS_DIAGRAM_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_DIAGRAM_CONNECTION))
#define LD_IS_DIAGRAM_CONNECTION_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_DIAGRAM_CONNECTION))
#define LD_DIAGRAM_CONNECTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
LD_DIAGRAM_CONNECTION, \
LdDiagramConnectionClass))
typedef struct _LdDiagramConnection LdDiagramConnection;
typedef struct _LdDiagramConnectionPrivate LdDiagramConnectionPrivate;
@@ -61,4 +67,3 @@ void ld_diagram_connection_set_points (LdDiagramConnection *self,
G_END_DECLS
#endif /* ! __LD_DIAGRAM_CONNECTION_H__ */

View File

@@ -69,7 +69,7 @@ static void on_set_param_redo (gpointer user_data);
static void on_set_param_destroy (gpointer user_data);
G_DEFINE_TYPE (LdDiagramObject, ld_diagram_object, G_TYPE_OBJECT);
G_DEFINE_TYPE (LdDiagramObject, ld_diagram_object, G_TYPE_OBJECT)
static void
ld_diagram_object_class_init (LdDiagramObjectClass *klass)

View File

@@ -15,16 +15,20 @@ G_BEGIN_DECLS
#define LD_TYPE_DIAGRAM_OBJECT (ld_diagram_object_get_type ())
#define LD_DIAGRAM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_DIAGRAM_OBJECT, LdDiagramObject))
#define LD_DIAGRAM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_DIAGRAM_OBJECT, LdDiagramObjectClass))
#define LD_IS_DIAGRAM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_DIAGRAM_OBJECT))
#define LD_IS_DIAGRAM_OBJECT_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_DIAGRAM_OBJECT))
#define LD_DIAGRAM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_DIAGRAM_OBJECT, LdDiagramObjectClass))
#define LD_DIAGRAM_OBJECT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
LD_TYPE_DIAGRAM_OBJECT, \
LdDiagramObject))
#define LD_DIAGRAM_OBJECT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
LD_TYPE_DIAGRAM_OBJECT, \
LdDiagramObjectClass))
#define LD_IS_DIAGRAM_OBJECT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_DIAGRAM_OBJECT))
#define LD_IS_DIAGRAM_OBJECT_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_DIAGRAM_OBJECT))
#define LD_DIAGRAM_OBJECT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_DIAGRAM_OBJECT, LdDiagramObjectClass))
typedef struct _LdDiagramObject LdDiagramObject;
typedef struct _LdDiagramObjectPrivate LdDiagramObjectPrivate;
@@ -74,4 +78,3 @@ void ld_diagram_object_set_y (LdDiagramObject *self, gdouble y);
G_END_DECLS
#endif /* ! __LD_DIAGRAM_OBJECT_H__ */

View File

@@ -33,7 +33,7 @@ static void ld_diagram_symbol_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec);
G_DEFINE_TYPE (LdDiagramSymbol, ld_diagram_symbol, LD_TYPE_DIAGRAM_OBJECT);
G_DEFINE_TYPE (LdDiagramSymbol, ld_diagram_symbol, LD_TYPE_DIAGRAM_OBJECT)
static void
ld_diagram_symbol_class_init (LdDiagramSymbolClass *klass)

View File

@@ -15,16 +15,20 @@ G_BEGIN_DECLS
#define LD_TYPE_DIAGRAM_SYMBOL (ld_diagram_symbol_get_type ())
#define LD_DIAGRAM_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_DIAGRAM_SYMBOL, LdDiagramSymbol))
#define LD_DIAGRAM_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_DIAGRAM_SYMBOL, LdDiagramSymbolClass))
#define LD_IS_DIAGRAM_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_DIAGRAM_SYMBOL))
#define LD_IS_DIAGRAM_SYMBOL_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_DIAGRAM_SYMBOL))
#define LD_DIAGRAM_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_DIAGRAM_SYMBOL, LdDiagramSymbolClass))
#define LD_DIAGRAM_SYMBOL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
LD_TYPE_DIAGRAM_SYMBOL, \
LdDiagramSymbol))
#define LD_DIAGRAM_SYMBOL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
LD_TYPE_DIAGRAM_SYMBOL, \
LdDiagramSymbolClass))
#define LD_IS_DIAGRAM_SYMBOL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_DIAGRAM_SYMBOL))
#define LD_IS_DIAGRAM_SYMBOL_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_DIAGRAM_SYMBOL))
#define LD_DIAGRAM_SYMBOL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_DIAGRAM_SYMBOL, LdDiagramSymbolClass))
typedef struct _LdDiagramSymbol LdDiagramSymbol;
typedef struct _LdDiagramSymbolPrivate LdDiagramSymbolPrivate;
@@ -70,4 +74,3 @@ void ld_diagram_symbol_set_rotation (LdDiagramSymbol *self, gint rotation);
G_END_DECLS
#endif /* ! __LD_DIAGRAM_SYMBOL_H__ */

View File

@@ -1390,8 +1390,8 @@ move_selection (LdDiagramView *self, gdouble dx, gdouble dy)
static gboolean
is_object_selected (LdDiagramView *self, LdDiagramObject *object)
{
return g_list_find (ld_diagram_get_selection (self->priv->diagram),
object) != NULL;
return g_list_find (ld_diagram_get_selection (self->priv->diagram), object)
!= NULL;
}
static void

View File

@@ -15,16 +15,18 @@ 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))
#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;

View File

@@ -105,7 +105,7 @@ static void uninstall_object (LdDiagramObject *object, LdDiagram *self);
static void ld_diagram_unselect_all_internal (LdDiagram *self);
G_DEFINE_TYPE (LdDiagram, ld_diagram, G_TYPE_OBJECT);
G_DEFINE_TYPE (LdDiagram, ld_diagram, G_TYPE_OBJECT)
static void
ld_diagram_class_init (LdDiagramClass *klass)

View File

@@ -15,16 +15,15 @@ G_BEGIN_DECLS
#define LD_TYPE_DIAGRAM (ld_diagram_get_type ())
#define LD_DIAGRAM(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_DIAGRAM, LdDiagram))
#define LD_DIAGRAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_DIAGRAM, LdDiagramClass))
#define LD_IS_DIAGRAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_DIAGRAM))
#define LD_IS_DIAGRAM_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_DIAGRAM))
#define LD_DIAGRAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_DIAGRAM, LdDiagramClass))
#define LD_DIAGRAM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_DIAGRAM, LdDiagram))
#define LD_DIAGRAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_DIAGRAM, LdDiagramClass))
#define LD_IS_DIAGRAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_DIAGRAM))
#define LD_IS_DIAGRAM_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_DIAGRAM))
#define LD_DIAGRAM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_DIAGRAM, LdDiagramClass))
typedef struct _LdDiagram LdDiagram;
typedef struct _LdDiagramClass LdDiagramClass;
@@ -114,4 +113,3 @@ void ld_diagram_unselect_all (LdDiagram *self);
G_END_DECLS
#endif /* ! __LD_DIAGRAM_H__ */

View File

@@ -50,7 +50,7 @@ static gboolean foreach_dir (const gchar *path,
gpointer userdata, GError **error);
G_DEFINE_TYPE (LdLibrary, ld_library, G_TYPE_OBJECT);
G_DEFINE_TYPE (LdLibrary, ld_library, G_TYPE_OBJECT)
static void
ld_library_class_init (LdLibraryClass *klass)
@@ -427,4 +427,3 @@ ld_library_get_root (LdLibrary *self)
g_return_val_if_fail (LD_IS_LIBRARY (self), NULL);
return self->priv->root;
}

View File

@@ -15,16 +15,15 @@ G_BEGIN_DECLS
#define LD_TYPE_LIBRARY (ld_library_get_type ())
#define LD_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_LIBRARY, LdLibrary))
#define LD_LIBRARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_LIBRARY, LdLibraryClass))
#define LD_IS_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_LIBRARY))
#define LD_IS_LIBRARY_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_LIBRARY))
#define LD_LIBRARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_LIBRARY, LdLibraryClass))
#define LD_LIBRARY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_LIBRARY, LdLibrary))
#define LD_LIBRARY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_LIBRARY, LdLibraryClass))
#define LD_IS_LIBRARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_LIBRARY))
#define LD_IS_LIBRARY_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_LIBRARY))
#define LD_LIBRARY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_LIBRARY, LdLibraryClass))
typedef struct _LdLibrary LdLibrary;
typedef struct _LdLibraryPrivate LdLibraryPrivate;
@@ -66,4 +65,3 @@ LdCategory *ld_library_get_root (LdLibrary *self);
G_END_DECLS
#endif /* ! __LD_LIBRARY_H__ */

View File

@@ -23,4 +23,3 @@ void ld_lua_private_draw (LdLua *self, LdLuaSymbol *symbol, cairo_t *cr);
G_END_DECLS
#endif /* ! __LD_LUA_PRIVATE_H__ */

View File

@@ -37,4 +37,3 @@ struct _LdLuaSymbolPrivate
G_END_DECLS
#endif /* ! __LD_LUA_SYMBOL_PRIVATE_H__ */

View File

@@ -32,7 +32,7 @@ static const LdPointArray *ld_lua_symbol_real_get_terminals (LdSymbol *symbol);
static void ld_lua_symbol_real_draw (LdSymbol *symbol, cairo_t *cr);
G_DEFINE_TYPE (LdLuaSymbol, ld_lua_symbol, LD_TYPE_SYMBOL);
G_DEFINE_TYPE (LdLuaSymbol, ld_lua_symbol, LD_TYPE_SYMBOL)
static void
ld_lua_symbol_class_init (LdLuaSymbolClass *klass)
@@ -135,4 +135,3 @@ ld_lua_symbol_real_draw (LdSymbol *symbol, cairo_t *cr)
ld_lua_private_draw (self->priv->lua, self, cr);
cairo_restore (cr);
}

View File

@@ -15,16 +15,16 @@ G_BEGIN_DECLS
#define LD_TYPE_LUA_SYMBOL (ld_lua_symbol_get_type ())
#define LD_LUA_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_LUA_SYMBOL, LdLuaSymbol))
#define LD_LUA_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_LUA_SYMBOL, LdLuaSymbolClass))
#define LD_IS_LUA_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_LUA_SYMBOL))
#define LD_IS_LUA_SYMBOL_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_LUA_SYMBOL))
#define LD_LUA_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_LUA_SYMBOL, LdLuaSymbolClass))
#define LD_LUA_SYMBOL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_LUA_SYMBOL, LdLuaSymbol))
#define LD_LUA_SYMBOL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_LUA_SYMBOL, LdLuaSymbolClass))
#define LD_IS_LUA_SYMBOL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_LUA_SYMBOL))
#define LD_IS_LUA_SYMBOL_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_LUA_SYMBOL))
#define LD_LUA_SYMBOL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_LUA_SYMBOL, LdLuaSymbolClass))
typedef struct _LdLuaSymbol LdLuaSymbol;
typedef struct _LdLuaSymbolPrivate LdLuaSymbolPrivate;
@@ -57,4 +57,3 @@ GType ld_lua_symbol_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* ! __LD_LUA_SYMBOL_H__ */

View File

@@ -150,7 +150,7 @@ static luaL_Reg ld_lua_cairo_table[] =
/* ===== Generic =========================================================== */
G_DEFINE_TYPE (LdLua, ld_lua, G_TYPE_OBJECT);
G_DEFINE_TYPE (LdLua, ld_lua, G_TYPE_OBJECT)
static void
ld_lua_class_init (LdLuaClass *klass)
@@ -187,8 +187,7 @@ ld_lua_init (LdLua *self)
lua_State *L;
LdLuaData *ud;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE
(self, LD_TYPE_LUA, LdLuaPrivate);
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, LD_TYPE_LUA, LdLuaPrivate);
L = self->priv->L = lua_newstate (ld_lua_alloc, NULL);
g_return_if_fail (L != NULL);
@@ -465,8 +464,7 @@ ld_lua_logdiag_register (lua_State *L)
lua_insert (L, -2);
lua_concat (L, 2);
g_warning ("Lua symbol registration failed: %s",
lua_tostring (L, -1));
g_warning ("Lua symbol registration failed: %s", lua_tostring (L, -1));
lua_pushboolean (L, FALSE);
}
else
@@ -861,4 +859,3 @@ LD_LUA_CAIRO_BEGIN (show_text)
g_object_unref (layout);
LD_LUA_CAIRO_END (0)

View File

@@ -15,16 +15,14 @@ G_BEGIN_DECLS
#define LD_TYPE_LUA (ld_lua_get_type ())
#define LD_LUA(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_LUA, LdLua))
#define LD_LUA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_LUA, LdLuaClass))
#define LD_IS_LUA(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_LUA))
#define LD_IS_LUA_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_LUA))
#define LD_LUA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_LUA, LdLuaClass))
#define LD_LUA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_LUA, LdLua))
#define LD_LUA_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_LUA, LdLuaClass))
#define LD_IS_LUA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_LUA))
#define LD_IS_LUA_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_LUA))
#define LD_LUA_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_LUA, LdLuaClass))
typedef struct _LdLua LdLua;
typedef struct _LdLuaPrivate LdLuaPrivate;
@@ -67,4 +65,3 @@ gboolean ld_lua_load_file (LdLua *self, const gchar *filename,
G_END_DECLS
#endif /* ! __LD_LUA_H__ */

View File

@@ -38,7 +38,7 @@ static void ld_symbol_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec);
G_DEFINE_ABSTRACT_TYPE (LdSymbol, ld_symbol, G_TYPE_OBJECT);
G_DEFINE_ABSTRACT_TYPE (LdSymbol, ld_symbol, G_TYPE_OBJECT)
static void
ld_symbol_class_init (LdSymbolClass *klass)

View File

@@ -15,16 +15,15 @@ G_BEGIN_DECLS
#define LD_TYPE_SYMBOL (ld_symbol_get_type ())
#define LD_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_SYMBOL, LdSymbol))
#define LD_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_SYMBOL, LdSymbolClass))
#define LD_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_SYMBOL))
#define LD_IS_SYMBOL_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_SYMBOL))
#define LD_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_SYMBOL, LdSymbolClass))
#define LD_SYMBOL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_SYMBOL, LdSymbol))
#define LD_SYMBOL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_SYMBOL, LdSymbolClass))
#define LD_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_SYMBOL))
#define LD_IS_SYMBOL_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_SYMBOL))
#define LD_SYMBOL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_SYMBOL, LdSymbolClass))
typedef struct _LdSymbol LdSymbol;
typedef struct _LdSymbolPrivate LdSymbolPrivate;
@@ -72,4 +71,3 @@ void ld_symbol_draw (LdSymbol *self, cairo_t *cr);
G_END_DECLS
#endif /* ! __LD_SYMBOL_H__ */

View File

@@ -256,7 +256,8 @@ ld_point_array_remove (LdPointArray *self, gint pos, guint length)
*
* Change size of the array.
*/
void ld_point_array_set_size (LdPointArray *self, guint size)
void
ld_point_array_set_size (LdPointArray *self, guint size)
{
g_return_if_fail (self != NULL);

View File

@@ -14,9 +14,9 @@
G_BEGIN_DECLS
#define LD_TYPE_POINT (ld_point_get_type ())
#define LD_TYPE_POINT (ld_point_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 ())
/**
@@ -99,4 +99,3 @@ void ld_rectangle_extend (LdRectangle *self, gdouble border);
G_END_DECLS
#endif /* ! __LD_TYPES_H__ */

View File

@@ -40,7 +40,7 @@ struct _LdUndoActionPrivate
static void ld_undo_action_finalize (GObject *gobject);
G_DEFINE_TYPE (LdUndoAction, ld_undo_action, G_TYPE_OBJECT);
G_DEFINE_TYPE (LdUndoAction, ld_undo_action, G_TYPE_OBJECT)
static void
ld_undo_action_class_init (LdUndoActionClass *klass)
@@ -84,9 +84,8 @@ ld_undo_action_finalize (GObject *gobject)
* Return value: a new #LdUndoAction object.
*/
LdUndoAction *
ld_undo_action_new (LdUndoActionFunc undo_func,
LdUndoActionFunc redo_func, LdUndoActionFunc destroy_func,
gpointer user_data)
ld_undo_action_new (LdUndoActionFunc undo_func, LdUndoActionFunc redo_func,
LdUndoActionFunc destroy_func, gpointer user_data)
{
LdUndoAction *self;

View File

@@ -15,16 +15,16 @@ G_BEGIN_DECLS
#define LD_TYPE_UNDO_ACTION (ld_undo_action_get_type ())
#define LD_UNDO_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_UNDO_ACTION, LdUndoAction))
#define LD_UNDO_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_UNDO_ACTION, LdUndoActionClass))
#define LD_IS_UNDO_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_UNDO_ACTION))
#define LD_IS_UNDO_ACTION_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_UNDO_ACTION))
#define LD_UNDO_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_UNDO_ACTION, LdUndoActionClass))
#define LD_UNDO_ACTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_UNDO_ACTION, LdUndoAction))
#define LD_UNDO_ACTION_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_UNDO_ACTION, LdUndoActionClass))
#define LD_IS_UNDO_ACTION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_UNDO_ACTION))
#define LD_IS_UNDO_ACTION_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_UNDO_ACTION))
#define LD_UNDO_ACTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_UNDO_ACTION, LdUndoActionClass))
typedef struct _LdUndoAction LdUndoAction;
typedef struct _LdUndoActionPrivate LdUndoActionPrivate;
@@ -73,4 +73,3 @@ void ld_undo_action_redo (LdUndoAction *self);
G_END_DECLS
#endif /* ! __LD_UNDO_ACTION_H__ */

View File

@@ -36,6 +36,7 @@
<menuitem action="NormalSize" />
</menu>
<menu name="HelpMenu" action="HelpMenu">
<menuitem action="UserGuide" />
<menuitem action="About" />
</menu>
</menubar>

View File

@@ -13,6 +13,11 @@
#include "ld-window-main.h"
#ifdef G_OS_WIN32
#include <gdk/gdkwin32.h>
#include <shellapi.h>
#endif
struct _LdWindowMainPrivate
{
@@ -100,6 +105,7 @@ static void on_action_open (GtkAction *action, LdWindowMain *self);
static void on_action_save (GtkAction *action, LdWindowMain *self);
static void on_action_save_as (GtkAction *action, LdWindowMain *self);
static void on_action_quit (GtkAction *action, LdWindowMain *self);
static void on_action_user_guide (GtkAction *action, LdWindowMain *self);
static void on_action_about (GtkAction *action, LdWindowMain *self);
static void on_action_undo (GtkAction *action, LdWindowMain *self);
@@ -176,9 +182,12 @@ static GtkActionEntry wm_action_entries[] =
G_CALLBACK (on_action_normal_size)},
{"HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL},
{"UserGuide", GTK_STOCK_HELP, N_("_User Guide"), NULL,
N_("Open the manual"),
G_CALLBACK (on_action_user_guide)},
{"About", GTK_STOCK_ABOUT, N_("_About"), NULL,
N_("Show a dialog about this application"),
G_CALLBACK (on_action_about)}
G_CALLBACK (on_action_about)},
};
static GtkToggleActionEntry wm_toggle_action_entries[] =
@@ -189,7 +198,7 @@ static GtkToggleActionEntry wm_toggle_action_entries[] =
{"LibraryPane", NULL, N_("_Library Pane"), NULL,
N_("Toggle displaying of the library pane"),
G_CALLBACK (on_action_library_pane), TRUE},
{"ShowGrid", NULL, N_("Show _Grid"), NULL,
{"ShowGrid", NULL, N_("Show _Grid"), "numbersign",
N_("Toggle displaying of the grid"),
G_CALLBACK (on_action_grid), TRUE}
};
@@ -215,7 +224,7 @@ ld_window_main_new (const gchar *filename)
return self;
}
G_DEFINE_TYPE (LdWindowMain, ld_window_main, GTK_TYPE_WINDOW);
G_DEFINE_TYPE (LdWindowMain, ld_window_main, GTK_TYPE_WINDOW)
static void
ld_window_main_class_init (LdWindowMainClass *klass)
@@ -973,10 +982,110 @@ on_action_quit (GtkAction *action, LdWindowMain *self)
gtk_widget_destroy (GTK_WIDGET (self));
}
static GFile *
user_guide_path (const gchar *language)
{
gchar *filename, *path;
GFile *file;
filename = g_strdup_printf ("user-guide-%s.html", language);
path = g_build_filename (PROJECT_DOC_DIR, "user-guide", filename, NULL);
g_free (filename);
file = g_file_new_for_path (path);
g_free (path);
return file;
}
static gboolean
open_file (GFile *file, GdkScreen *screen, GError **error)
{
GdkDisplay *display;
GAppInfo *app_info;
GdkAppLaunchContext *context;
GList link;
gboolean success;
/* GLib 2.36.1 prevents us from using gtk_show_uri() on Windows XP. */
if (!(app_info = g_file_query_default_handler (file, NULL, error)))
return FALSE;
link.next = link.prev = NULL;
link.data = file;
display = gdk_screen_get_display (screen);
context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_screen (context, screen);
success = g_app_info_launch (app_info,
&link, G_APP_LAUNCH_CONTEXT (context), error);
g_object_unref (context);
return success;
}
static void
on_action_user_guide (GtkAction *action, LdWindowMain *self)
{
const gchar *const *iter;
GFile *file;
GError *error = NULL;
/* Look for a usable language variant, or fall back to the lingua franca. */
for (iter = g_get_language_names (); *iter; iter++)
{
if (g_file_query_exists ((file = user_guide_path (*iter)), NULL))
break;
g_object_unref (file);
}
if (!*iter)
file = user_guide_path ("en");
if (!open_file (file, gtk_window_get_screen (GTK_WINDOW (self)), &error))
{
GtkWidget *message_dialog;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (self),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
_("Failed to open the user guide"));
gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG (message_dialog), "%s", error->message);
g_error_free (error);
gtk_dialog_run (GTK_DIALOG (message_dialog));
gtk_widget_destroy (message_dialog);
}
g_object_unref (file);
}
static gboolean
on_action_about_activate_link (GtkAboutDialog *dialog, gchar *uri,
LdWindowMain *self)
{
GdkWindow *window;
window = gtk_widget_get_window (GTK_WIDGET (self));
#ifdef G_OS_WIN32
/* gtk_show_uri() on Windows XP fails, due to trying to establish
* an SSL connection, so let's first try to not do that on Windows.
* `cmd.exe /c start "" ...` would pop up a command line window,
* so use SHELL32.DLL directly. rundll does not cover this.
* There doesn't seem to be anything better directly in GIO/GLib.
*
* When we fail here, we fall back to normal processing.
*/
if ((INT_PTR) ShellExecute (gdk_win32_window_get_handle (window),
"open", uri, NULL, NULL, SW_SHOWNORMAL) > 32)
return TRUE;
#endif /* G_OS_WIN32 */
return FALSE;
}
static void
on_action_about (GtkAction *action, LdWindowMain *self)
{
gtk_show_about_dialog (GTK_WINDOW (self),
GtkWidget *about_dialog;
about_dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
"program-name", PROJECT_NAME,
"logo-icon-name", PROJECT_NAME,
"version", PROJECT_VERSION,
@@ -984,6 +1093,15 @@ on_action_about (GtkAction *action, LdWindowMain *self)
"copyright", "Copyright 2010 - 2021 Přemysl Eric Janouch",
"website", PROJECT_URL,
NULL);
g_signal_connect (about_dialog, "activate-link",
G_CALLBACK (on_action_about_activate_link), self);
gtk_window_set_transient_for (GTK_WINDOW (about_dialog), GTK_WINDOW (self));
gtk_window_set_modal (GTK_WINDOW (about_dialog), TRUE);
gtk_window_set_destroy_with_parent (GTK_WINDOW (about_dialog), TRUE);
gtk_dialog_run (GTK_DIALOG (about_dialog));
gtk_widget_destroy (about_dialog);
}
static void

View File

@@ -15,16 +15,16 @@ G_BEGIN_DECLS
#define LD_TYPE_WINDOW_MAIN (ld_window_main_get_type ())
#define LD_WINDOW_MAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST \
((obj), LD_TYPE_WINDOW_MAIN, LdWindowMain))
#define LD_WINDOW_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
((klass), LD_TYPE_WINDOW_MAIN, LdWindowMainClass))
#define LD_IS_WINDOW_MAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
((obj), LD_TYPE_WINDOW_MAIN))
#define LD_IS_WINDOW_MAIN_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
((klass), LD_TYPE_WINDOW_MAIN))
#define LD_WINDOW_MAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
((obj), LD_WINDOW_MAIN, LdWindowMainClass))
#define LD_WINDOW_MAIN(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), LD_TYPE_WINDOW_MAIN, LdWindowMain))
#define LD_WINDOW_MAIN_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), LD_TYPE_WINDOW_MAIN, LdWindowMainClass))
#define LD_IS_WINDOW_MAIN(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), LD_TYPE_WINDOW_MAIN))
#define LD_IS_WINDOW_MAIN_CLASS(klass) \
(G_TYPE_CHECK_INSTANCE_TYPE ((klass), LD_TYPE_WINDOW_MAIN))
#define LD_WINDOW_MAIN_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), LD_WINDOW_MAIN, LdWindowMainClass))
typedef struct _LdWindowMain LdWindowMain;
typedef struct _LdWindowMainPrivate LdWindowMainPrivate;
@@ -53,4 +53,3 @@ GtkWidget *ld_window_main_new (const gchar *filename);
G_END_DECLS
#endif /* ! __LD_WINDOW_MAIN_H__ */

View File

@@ -161,6 +161,11 @@ main (int argc, char *argv[])
}
#endif
#ifdef OPTION_NOINSTALL
gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (),
PROJECT_SHARE_DIR "icons");
#endif
gtk_window_set_default_icon_name (PROJECT_NAME);
if (files)
@@ -175,4 +180,3 @@ main (int argc, char *argv[])
gtk_main ();
return 0;
}