Compare commits

..

115 Commits
v6.2 ... face

Author SHA1 Message Date
abakkk ccfbfb4af8 update README 2021-06-19 13:32:55 +02:00
abakkk 463c1a4c5a update to Codeberg 2021-05-28 18:09:02 +02:00
abakkk 40f4f0b946 change license 2021-05-27 18:54:08 +02:00
abakkk 5df2f8b992 Merge branch 'pile' into 'face'
v11.1
2021-04-26 15:00:37 +02:00
abakkk d716a398dc version -> 11.1 2021-04-26 14:31:16 +02:00
abakkk 996a035017 update "How to draw an arrow" media in README 2021-04-26 14:30:36 +02:00
abakkk 92b8bddb6b simplify prefs getChildrenOf
GTK4 widgets are iterable.
2021-04-26 12:00:16 +02:00
abakkk 25e1f27ac9 make helper not blocking 2021-04-04 12:09:33 +02:00
abakkk 5ad5dfffd1 not to erase the text on Escape key pressed
Related to #60.
2021-03-11 09:37:17 +01:00
abakkk cb40739af7 override default handlers in prefs
Use GJS GObject overrides. Not to matter whether the signal exists.
2021-03-11 09:20:39 +01:00
O. Giesmann c87003101c Update draw-on-your-screen.po 2021-03-10 09:50:35 +01:00
abakkk e9abbbb1c4 Merge branch 'pile' into 'face'
v11

See merge request abakkk/DrawOnYourScreen!22
2021-02-20 00:26:42 +00:00
abakkk 41e7a9d547 version -> 11 2021-02-20 01:14:22 +01:00
abakkk 1a993dca38 update french localization 2021-02-20 01:13:39 +01:00
abakkk e470e2f40d fixes for old GS versions 2021-02-20 00:56:21 +01:00
abakkk 137742d471 adapt to Clutter API changes
device.get_coords() has been removed and seat.query_state() is unusable with null sequences.
2021-02-19 23:24:04 +01:00
abakkk d125d77d01 Gtk4 port
Tested with Gtk 4.1.0.
2021-02-19 23:23:58 +01:00
abakkk f087570eb5 minor, param renaming
"showTextRectangle" -> "showElementBounds" and
"drawTextRectangle" -> "drawElementBounds".
2021-02-19 23:21:35 +01:00
abakkk 27a398d0e1 add convenient marks for rotation and stretch transformations 2021-02-19 23:21:04 +01:00
abakkk ca6baf0dc8 minor, enumeration syntax 2021-02-19 23:20:57 +01:00
abakkk cb49c83799 add centered text alignment 2021-02-19 23:20:29 +01:00
abakkk 3223a6fdca return to start a new text line
`Shift + Return` was not compatible with the ibusCandidatePopup.

So the only way to "validate" a text element is to click outside the text area.

Related to #56.
2021-02-19 23:19:58 +01:00
abakkk 5698f3f7cb multi-line text elements
* Can browse and break lines anywhere
* Can past multi-line texts
* Do not need lineIndex anymore and grouped lines are preserved permanently

Related to #56
2021-02-19 23:19:50 +01:00
abakkk f18e8e6ac0 add toggle animations
* background
* grid
* square area
2021-02-19 23:19:41 +01:00
abakkk 0e6428404e Merge branch 'dev' into 'master'
v10

Closes #52

See merge request abakkk/DrawOnYourScreen!21
2020-10-21 09:40:31 +02:00
abakkk 5e14f261b3 version -> 10 2020-10-21 09:37:33 +02:00
abakkk e588728d3d Dot not use stateObj
Remove `Me.stateObj.areaManager`.
It caused errors on extension updated from ego (`JS ERROR: TypeError: Me.stateObj.areaManager is undefined`).
2020-10-21 09:33:40 +02:00
abakkk e99927d985 fix multi-monitor
Layer container allocation box is relative to the drawing area. So transform stage point before checking.

Fix 58677dc1.
Close #52.
2020-10-21 09:33:40 +02:00
abakkk baf5e7c968 hide square area outline
Hide the square area outline when the drawing area is not reactive.

Fix 58677dc1.
2020-10-21 09:33:40 +02:00
abakkk 28a9d79d03 fix french localization 2020-10-21 09:28:57 +02:00
O. Giesmann 1437091725 update deutsch localization
close !20
2020-10-16 11:06:02 +02:00
abakkk 022fb02556 update french localization 2020-10-12 11:32:22 +02:00
abakkk ea11a92689 Merge branch 'dev' into 'master'
v9

See merge request abakkk/DrawOnYourScreen!19
2020-10-12 11:25:25 +02:00
abakkk c9c214c6d5 version -> 9 2020-10-12 11:22:48 +02:00
abakkk 9731ebecb7 start a new line with "Shift + Enter"
Text tool:
* Enter: valid text and close text entry.
* Escape: close text entry.
* Shift + Enter: Start a new line.

related to #30.
2020-10-12 11:09:20 +02:00
abakkk cddfa3172f Font size markup bug workaround
The "small" font size attribute was applied to the whole text.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1467
2020-10-11 13:09:28 +02:00
abakkk 80b49f2a1d SVG size and layer container
Fix SVG size by taking the size of the layers.
2020-10-11 09:28:02 +02:00
abakkk bb90ab6040 bind grid layer visibility and hasGrid
Repaint an empty grid layer is useless.
2020-10-10 15:05:12 +02:00
abakkk dd45e87f01 layers and eraser
Paint the current element in the `backLayer` when it is in "eraser mode".
2020-10-10 15:02:01 +02:00
abakkk 556cbb2ab3 remove debug constants
Remove CAIRO_DEBUG_EXTENDS and SVG_DEBUG_EXTENDS.
2020-10-09 11:56:47 +02:00
abakkk 58677dc175 Split the drawing area in several layer widgets.
The drawing area is now a container and the layers are the proper drawing widgets. There is a separated layer for the current element so only the current element is redisplayed when drawing.
2020-10-09 11:51:01 +02:00
abakkk ed167f8d1b fix transformation stopping
* Handle case where grabbed element does not have transformation to stop.
* Update cursor after erasing drawing while an element is grabbed.
2020-10-09 08:48:42 +02:00
O. Giesmann 44ba9ba17d create deutsch localization
related to #47.
2020-10-07 09:48:09 +02:00
abakkk b3fffc193e Merge branch 'dev' into 'master'
v8.1

Closes #46 and #45

See merge request abakkk/DrawOnYourScreen!18
2020-10-06 17:31:03 +02:00
abakkk 42eff0fa05 version -> 8.1 2020-10-06 17:20:59 +02:00
abakkk ff350130a4 rework of key event handling
* Handle stage key events only when the area is reactive. Any reason to handle key events in other cases?
* Move `Escape` key handling to the stage `key-press-event` handler. So leaving the drawing mode with `Escape` is still possible when the overview mode has been entered inadvertently.
2020-10-05 16:46:16 +02:00
abakkk 28def0059d finish undo/redo rework
* "Undo(Redo) last brushstroke" -> "Undo(Redo)".
* Sync `_updateActionSensitivity` menu method with the new undo/redo behavior.
* Smooth button action is no longer destructive.
* Clean undone smooth transformations when doing a new smooth transformation.
2020-10-04 22:48:40 +02:00
abakkk 236e4db236 transformation notUndoable => undoable
The `undoable` transformation property is not preserved when the element is "stringified". So transformations cannot be undone, once the element is loaded from JSON.
2020-10-04 22:17:13 +02:00
abakkk ccf928c048 make smooth transformations undoable/redoable 2020-10-04 20:55:06 +02:00
abakkk e218819edd make transformations undoable/redoable 2020-10-04 17:20:03 +02:00
abakkk 6374cc8c47 motion timeout
Add intermediate points to make quick free drawings smoother.
Do not redisplay the area at this step (crashes).
Use device.get_coords rather than global.get_pointer because the later return rounded (floor) values.

Fix #45.
2020-10-04 11:12:47 +02:00
abakkk 82aee30657 fix unsanitized GType names
With old GS/GJS, some GType names were generated from class names without sanitizing it (e.g. Menu.ActionButton).

Instead of defining all GType names, sanitize all class name as it was GType name, and let GJS generated GType name securely when it is necessary.

Fix #46.
2020-10-04 10:01:55 +02:00
abakkk 6e99e380cb Merge branch 'dev' into 'master'
Dev

See merge request abakkk/DrawOnYourScreen!17
2020-09-27 19:35:29 +02:00
abakkk 950881d1c3 version -> 8 2020-09-27 19:33:49 +02:00
abakkk bf75da8fa8 add some media to the readme 2020-09-27 19:20:38 +02:00
abakkk 79f27d1b25 improve menu max-height
* Take scale factor into account.
* Put it in '_onMenuOpenStateChanged' so the max-height will be updated if the monitor size change.

See PanelMenu.Button.
2020-09-25 12:50:10 +02:00
abakkk 129c8f584c Name GTypes and classes against extension uuid.
For DeepExtensionReloader.
2020-09-25 11:55:36 +02:00
abakkk 6892b9c582 fix NEWS 2020-09-22 23:45:55 +02:00
abakkk 1db60b6d4e Merge branch 'dev' into 'master'
v7

See merge request abakkk/DrawOnYourScreen!16
2020-09-22 23:28:17 +02:00
abakkk fba13926c4 version -> 7 2020-09-22 23:24:17 +02:00
abakkk 3c67bf3398 colored SVG images
Color (fill) SVG images by pressing the `Shift` key.
2020-09-22 23:21:48 +02:00
abakkk 532b9242c9 image element, minor
* image.toJson -> image.toJSON.
* remove unused 'fill' and 'operator' properties.
2020-09-22 18:22:41 +02:00
abakkk 27e194905b add gpl import
* Import palettes from a .gpl file (one palette for each column).
* Add possibility to use more than 9 palettes.
* Color display names support.
* color.toJSON for svg and drawing saves, color.toString for display.
2020-09-22 17:31:48 +02:00
abakkk 4cc0c9e028 Mention Color Picker extension in the readme 2020-09-21 15:21:12 +02:00
abakkk dd18ca3051 bunch of menu optimizations
* A minimum width for the menu, the same as the aggregate menu, in order to prevent the menu with from growing on submenu open.
* A maximum width for uncontrolled content (font, image and drawing names). Same value and same reason.
* Style the font family labels in idle loop to open the submenu fastly.
* Add the drawing gicons in idle loop to open the submenu smoothly.
2020-09-20 15:40:45 +02:00
abakkk 737bc856c4 color-picker extension support
The color picker use the ["Color Picker" extensions](https://github.com/tuberry/color-picker) if it is available thanks to `pickAsync` "api". In comparaison to the GS color picker, it provides a colored cursor and a menu to adjust the color.
2020-09-20 15:40:45 +02:00
abakkk af694382c8 add color picker
It wraps the upstream color picker, that is designed for DBus access.
There is a shortcut and a menu button.
2020-09-20 15:40:45 +02:00
tuberry 9977a037ec Simplified Chinese localization update 2020-09-20 15:39:19 +02:00
abakkk b1cbc63f0b French localization update 2020-09-20 14:27:51 +02:00
abakkk 8af42fbad8 version -> v6.4 2020-09-19 00:38:09 +02:00
abakkk 34eb8e930b Merge branch 'dev' into 'master'
v6.4

See merge request abakkk/DrawOnYourScreen!15
2020-09-19 00:34:29 +02:00
abakkk d20040b135 fix textEntry position
* element.x and element.y are relative to the area, not to the stage.
* Do not hide and do not set opacity to 0 because ibusCandidatePopup need a mapped text entry to init correctly its position.
2020-09-19 00:24:50 +02:00
abakkk eb87714adc area._stopAll
* pros: the function is shared and it decreases bugs.
* cons: drawing/writing/transfo are not deleted if unfinished.
2020-09-18 19:13:10 +02:00
abakkk 324c066685 PangoCairo.show_layout_line
use `PangoCairo.show_layout_line` instead of `PangoCairo.show_layout`. It is equivalent.

show_layout (doc): "The top-left corner of the PangoLayout will be drawn at the current point of the cairo context."
show_layout_line (doc): "The origin of the glyphs (the left edge of the line) will be drawn at the current point of the cairo context."
So it is no longer necessary to query `layout.get_baseline()`.
2020-09-18 18:37:01 +02:00
abakkk 5e43b05740 fix Jsons directory monitor
`directory.monitor(...)` -> `directory.monitor_directory(...)`.
It is important to specify that the file to monitor is a directory because maybe the directory does not exist yet and remove events would not be monitored.
2020-09-18 12:54:06 +02:00
abakkk 1677425413 "Unlock image ratio" -> "Do not preserve image ratio" 2020-09-18 11:53:19 +02:00
abakkk f7d1f15cf5 add tooltips to "Open drawing" submenu buttons 2020-09-18 11:42:16 +02:00
abakkk 277a3b244b trim clipboad text lines
Since 3.38 there is a line terminator character, that has to be removed with .trim().
2020-09-18 11:05:44 +02:00
abakkk 2ac453139f GS 3.38 removed ui/tweener.js 2020-09-18 09:21:07 +02:00
abakkk 6f76640146 Merge branch 'dev' into 'master'
v6.3

Closes #42

See merge request abakkk/DrawOnYourScreen!14
2020-09-17 22:39:36 +02:00
abakkk b4d680b5ba version -> 6.3 2020-09-17 22:34:00 +02:00
abakkk 509fa0be29 adjust some translated strings 2020-09-17 22:31:39 +02:00
abakkk 23eea44661 add "Persistent over toggles' setting
* Rename "Persistent" to "Persistent over restarts".
* If disabled, "Persistent over toggles" has priority over "Persistent over restarts" and "Drawing on the desktop".

Close issue #42.
2020-09-17 17:30:30 +02:00
abakkk 072adde856 group menu items at the bottom
In addition, 'Save as a SVG file' -> "Export to a SVG file'.
2020-09-17 17:29:59 +02:00
abakkk f9e25fa8f6 clean svg exports
* Group "transform" attributes.
* Round "transform" attribute values.
* Remove unused stroke attributes.
* Add an "eraser" class attribute to let user retrieve the element role.
2020-09-16 22:10:40 +02:00
abakkk 1d73d9f0e3 pass color and font when duplacting
Fix commit 42b4c9c0 .
2020-09-16 17:38:54 +02:00
abakkk 81bce359f9 improve icons, minor 2020-09-16 13:42:22 +02:00
abakkk e3b32ace3b fix ImageFromJson
Do not use the same content for insertable image and gicon. The former depends on the area size whereas the later is square.
2020-09-16 08:52:36 +02:00
abakkk 99964991c0 change some shortcuts
Replace some `Shift + Ctrl + ...` to `Ctrl + Alt + ...`.
2020-09-15 02:06:39 +02:00
abakkk cde5bab27d fix icons
* Old Adwaita icon theme does not contain 'view-mirror-symbolic' icon.
* Redraw `tool-no-symbolic.svg` because of bad rendering in old GNOMEs.
2020-09-15 01:48:01 +02:00
abakkk 42b4c9c00c color and font
* Pass Clutter color and Pango fontDescription objects to elements, not strings.
* Do not use the color format '#rrggbbaa' in svg since it is not supported in GNOME 3.24.
2020-09-15 00:29:02 +02:00
abakkk b63c1e9ffa add possibility to insert an image directly from drawing save (.json)
The Image object is got from the Jsons objects of the openDrawing sub menu.
2020-09-14 22:44:20 +02:00
abakkk a8633f1fbc add gicons to menu openDrawingSubMenu items 2020-09-14 01:38:00 +02:00
abakkk 60091a94b6 rework of Files.Jsons
In the same way as Files.Images.
2020-09-13 23:50:09 +02:00
abakkk e53e69efcf minor, use array instead of object for "OTHER" shortcuts
Array is more semantically appropriate.
For example 2 actions may have the same translations (error of a translator). With an object (or a map), only the second would be displayed, which is problematic to alert to the problem.

Additionally, handle the case where some GSettings keybinding values are empty.
2020-09-13 15:46:22 +02:00
abakkk 464aae77c6 improve images again
* Files.Images does the same thing, with just a new accessor (getSorted).
* Files.Image is splited and the new subclass manage gicons.
2020-09-13 15:44:42 +02:00
abakkk 24682db69c add a lot of icons
* Complete Files.Icons.
* Add a lot of icons in the menu and the osd notifications.
2020-09-12 15:25:42 +02:00
abakkk 771bad2d59 improve images
* Let the user choose the directory.
* Rework of Files.Images.
* area.currentImage is now an ... image, not an index.
* Add 'switch-image-file-reverse' keybinding.
* Add image gicons (from thumbnails) in the submenu.
* Images are reset on drawing mode left or on images added from the clipboard.
2020-09-11 14:22:18 +02:00
abakkk a06d318646 rework of shortcuts.js 2020-09-10 15:55:19 +02:00
abakkk 8277710510 get all icons from Files.Icons 2020-09-10 15:19:17 +02:00
abakkk 442d20b387 paste image files from clipboard 2020-09-09 22:25:56 +02:00
abakkk 56008f3041 add ranges to drawing settings schema
* It is no longer required to clamp the setting value in area.js.
* Add a "range" property, completed with another 'step' property, to PixelSpinButton in order to directly initiate the lower and upper values of the adjustment from the relevant setting range.
* Not related: fix an inversion between Pango and Cairo in element.js.
2020-09-09 12:12:29 +02:00
abakkk 03b73862cc .pot rework
* .pot file can be generated automaticaly from new locale/POTFILES.in.
* move shortcuts key and strings to new shortcut.js
2020-09-09 09:40:45 +02:00
abakkk 2dd900bddf new DisplayStrings object
Group the most strings to display in a new DisplayStrings object.
It is used by both menu and osd notifications.
2020-09-07 18:56:48 +02:00
abakkk f9769c11f2 default font and font description
* Use interface font as default font
* Work with a `Pango.FontDescription` instead of separate font properties.
2020-09-05 00:03:05 +02:00
abakkk 5af13a1e12 add reset button to prefs 2020-09-03 09:04:01 +02:00
abakkk 2195aed3c0 move eraser/svg note
Remove the note about eraser and svg export from the prefs and add it to readme "Tips and tricks".
2020-09-02 16:40:19 +02:00
abakkk c1689cac75 rework prefs, settings, locales
Although there is a lot of changes, nothing is important.
2020-09-02 16:16:23 +02:00
abakkk 6a8afcc20a use timestamps instead of Math.random in elementGrabber 2020-08-31 14:06:47 +02:00
abakkk 89067a8dd9 use an Extension class 2020-08-31 13:05:41 +02:00
abakkk 1d95fac3bf add warning log on activation for unsupported GNOME Shell versions
As the extension may work in further GNOME Shell versions without targeted developpement, just add a small warning log without blocking anything.
2020-08-31 11:13:49 +02:00
abakkk a128664921 minor, add 'exported' directive for linters 2020-08-31 11:05:33 +02:00
abakkk ecab1e2bed 'open-previous/next-drawing' shortcuts
Reuse `Ctrl + O` keybinding that have been freed by the previous commit (remove 'open-user-stylesheet')
2020-08-31 10:04:43 +02:00
abakkk b3a1a77160 replace user stylesheet with proper drawing settings
Since the most drawing params can be changed via menu or shortcuts, remove default.css and user.css.

* Missing params like palettes, dash, grid, etc, are added to prefs.
* Add palette choice to menu and shortcuts.
* Some defaults like fonts, line width, etc, are no longer modifiable by the user.
2020-08-31 09:43:00 +02:00
abakkk 01701538bb minor, rework settings 2020-08-23 11:49:26 +02:00
52 changed files with 6914 additions and 3393 deletions

675
COPYING Normal file
View File

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

339
LICENSE
View File

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
DrawOnYourScreen
Copyright (C) 2019 abakkk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

68
NEWS
View File

@ -1,3 +1,71 @@
v11.1 - April 2021
==================
* Not to erase the text when pressing "Escape" #60
v11 - February 2021
===================
* GS 40 compatibility (40.beta)
* Gtk4 port (preferences)
* Toggle animations (background, grid and square area)
* Multi-line text elements
* Start a new line with "Enter" (text tool)
* Add "centered" text alignment
* Convenient marks for rotation and stretch transformations
v10 - October 2020
==================
* Fix multi-monitor support #52
v9 - October 2020
=================
* Split the drawing area in several layers (performance)
* Start a new line with "Shift + Enter" (text tool)
v8.1 - October 2020
===================
* Fix unsanitized GType names #46
* Quick free drawings are smoother #45
* Transformations are undoable/redoable
v8 - September 2020
===================
Nothing.
v7 - September 2020
===================
* Can import GIMP palettes.
* Can color SVG images.
* Integrate color picker (GS buit-in or Color Picker extension).
v6.4 - September 2020
=====================
* Prepare GS 3.38 compatibility.
* Add tooltips to sub-menu buttons also.
* Fix drawing directory monitoring when it does not exist yet.
* Fix text entry / ibus candidate popup position.
v6.3 - September 2020
=====================
* Replace user stylesheet with proper drawing settings
* Multi-palettes
* Possibility to add insertable images from the clipboard
* Image directory is configurable
* Thumbnails in "Open drawing" sub-menu
* Drawings can be directly inserted as an image.
* Add a lot of icons in the menu and the OSD notifications
* Group menu items at the bottom
* Add tooltips to menu buttons
* New "Persistent over toggles' setting #42
v6.2 - August 2020
==================

View File

@ -3,11 +3,11 @@
Start drawing with Super+Alt+D.
Then save your beautiful work by taking a screenshot.
![](https://framagit.org/abakkk/DrawOnYourScreen/raw/ressources/screenshot.jpg)
![](https://codeberg.org/som/DrawOnYourScreen/raw/branch/media/screenshot.jpg)
## Features
* Basic shapes (rectangle, circle, ellipse, line, curve, text, image, free)
* Basic shapes (rectangle, circle, ellipse, line, curve, polygon, polyline, text, image, free)
* Basic transformations (move, rotate, resize, stretch, mirror, inverse)
* Smooth stroke
* Draw over applications
@ -18,33 +18,51 @@ Then save your beautiful work by taking a screenshot.
## Install
1. Download and decompress or clone the repository
2. Place the resulting directory in `~/.local/share/gnome-shell/extensions`
3. **Change the directory name** to `drawOnYourScreen@abakkk.framagit.org`
2. Place the directory (the one that contains `metadata.json`) in `~/.local/share/gnome-shell/extensions`
3. **Change the directory name** to `draw-on-your-screen@som.codeberg.org`
4. Xorg: type `alt + F2` and `r` to restart gnome-shell
Wayland: restart or re-login
5. Enable the extension in gnome-tweaks or gnome-shell-extension-prefs
5. Enable the extension with GNOME Extensions or GNOME Tweaks application
6. `Super + Alt + D` to test
7. [https://framagit.org/abakkk/DrawOnYourScreen/issues](https://framagit.org/abakkk/DrawOnYourScreen/issues) to say it doesn't work
7. [https://codeberg.org/som/DrawOnYourScreen/issues](https://codeberg.org/som/DrawOnYourScreen/issues) to say it doesn't work
## Details
## Tips and tricks
* Power is nothing without control:
The `Ctrl` key provides an extra functionality for each tool.
[Range of Ctrl key possibilities](https://codeberg.org/som/DrawOnYourScreen/src/branch/media/ctrl.webm)
* Draw arrows:
Intersect two lines and curve the second thanks to the `Ctrl` key.
![How to draw an arrow](https://framagit.org/abakkk/DrawOnYourScreen/uploads/af8f96d33cfeff49bb922a1ef9f4a4ce/arrow-screencast.webm)
[How to draw an arrow](https://codeberg.org/som/DrawOnYourScreen/src/branch/media/arrow.webm)
* Duplicate an element:
Hold the `Shift` key while starting moving.
![How to duplicate an element](https://framagit.org/abakkk/DrawOnYourScreen/-/raw/ressources/duplicate.webm)
[How to duplicate an element](https://codeberg.org/som/DrawOnYourScreen/src/branch/media/duplicate.webm)
* Insertable images:
Add your images (jpeg, png, svg) to `~/.local/share/drawOnYourScreen/images/`.
You can insert images (jpeg, png, svg) in your drawings. By default images are sought in `~/.local/share/draw-on-your-screen/images/` but the location is configurable in the preferences. Another way is to copy-past the images from Nautilus or any clipboard source by using the usual `Ctrl + V` shortcut inside the drawing mode.
[How to add images from Nautilus](https://codeberg.org/som/DrawOnYourScreen/src/branch/media/ctrl-plus-v.webm)
* Eraser and SVG:
There is no eraser in SVG so when you export elements made with the eraser to a SVG file, they are colored with the background color, transparent if it is disabled. See `“Add a drawing background”` or edit the SVG file afterwards.
* Screenshot Tool extension:
[Screenshot Tool](https://extensions.gnome.org/extension/1112/screenshot-tool/) is a convenient extension to “create, copy, store and upload screenshots”. In order to select a screenshoot area with your pointer while keeping the drawing in place, you need first to tell DrawOnYourScreen to ungrab the pointer (`Ctrl + Super + Alt + D`).
* Color Picker extension:
If the GNOME Shell built-in color picker is too basic for you, have a look at the [Color Picker extension](https://extensions.gnome.org/extension/3396/color-picker), which let's you select the pixel accurately, preview the color and adjust its values. Once installed and enabled, it will be transparently integrated into DrawOnYourScreen.
![Color Picker extension in action](https://codeberg.org/som/DrawOnYourScreen/raw/branch/media/color-picker-extension.jpg)

1221
area.js

File diff suppressed because it is too large Load Diff

View File

@ -1,151 +0,0 @@
/*
* WARNING : user.css may be obsolete after an extension update.
*
* ~/.local/share/drawOnYourScreen/user.css file is automatically generated by activating "Edit style".
* Delete ~/.local/share/drawOnYourScreen/user.css file to retrieve the default drawing style.
*
* Except for the font, you don't need to restart the extension.
* Just save this file as ~/.local/share/drawOnYourScreen/user.css and the changes will be applied for your next brushstroke.
* Some attributes are modifiable in the user interface.
*
* line-join (no string):
* 0 : miter, 1 : round, 2 : bevel
* line-cap (no string):
* 0 : butt, 1 : round, 2 : square
* fill-rule (no string):
* 0 : nonzero (winding in Cairo), 1 : evenodd
*
* dash:
* By default, it is computed from the line width.
* dash-array-on is the length of dashes (put 0.1 to get dots or squares according to line-cap).
* dash-array-off is the length of gaps.
*
* square area:
* Drawing in a square area is convenient when using the extension as a vector graphics editor. By default,
* when toggling 'Square drawing area', the area is sized to 75% of monitor size. You can fix and customize this size
* by uncommenting square-area-width and square-area-height lines.
*
* font:
* Only one family : no comma separated list of families like "font1, font2, ..., Sans-Serif".
* Font family can be any font installed, or a generic family name (Serif, Sans-Serif, Monospace, Cursive, Fantasy).
* Font weight and font style : no upper case when string.
*
* text-align: left or right.
*
*/
.draw-on-your-screen {
-drawing-line-width: 5px;
-drawing-line-join: 1;
-drawing-line-cap: 1;
-drawing-fill-rule: 0;
/*-drawing-dash-array-on: 5px;*/
/*-drawing-dash-array-off: 15px;*/
/*-drawing-dash-offset: 0px;*/
-drawing-background-color: #2e2e2e;
-grid-overlay-gap: 10px;
-grid-overlay-line-width: 0.4px;
-grid-overlay-interline-width: 0.2px;
-grid-overlay-color: Gray;
/*-drawing-square-area-width: 512px;*/
/*-drawing-square-area-height: 512px;*/
font-family: Cantarell;
font-weight: normal;
font-style: normal;
text-align: left;
}
/* Palette */
.draw-on-your-screen {
-drawing-color1: HotPink;
-drawing-color2: Cyan;
-drawing-color3: yellow;
-drawing-color4: Orangered;
-drawing-color5: Chartreuse;
-drawing-color6: DarkViolet;
-drawing-color7: White;
-drawing-color8: Gray;
-drawing-color9: Black;
}
/*
Example of alternative palettes from GNOME HIG Colors.
https://developer.gnome.org/hig/stable/icon-design.html
The last uncommented palette wins.
*/
/* lighter */
/*
.draw-on-your-screen {
-drawing-color1: rgb(153, 193, 241);
-drawing-color2: rgb(143, 240, 164);
-drawing-color3: rgb(249, 240, 107);
-drawing-color4: rgb(255, 190, 111);
-drawing-color5: rgb(246, 97, 81);
-drawing-color6: rgb(220, 138, 221);
-drawing-color7: rgb(205, 171, 143);
-drawing-color8: rgb(255, 255, 255);
-drawing-color9: rgb(119, 118, 123);
}
*/
/* light */
/*
.draw-on-your-screen {
-drawing-color1: rgb( 98, 160, 241);
-drawing-color2: rgb( 87, 227, 137);
-drawing-color3: rgb(248, 228, 92);
-drawing-color4: rgb(255, 163, 72);
-drawing-color5: rgb(237, 51, 59);
-drawing-color6: rgb(192, 97, 203);
-drawing-color7: rgb(181, 131, 90);
-drawing-color8: rgb(246, 245, 244);
-drawing-color9: rgb( 94, 92, 100);
}
*/
/* normal */
/*
.draw-on-your-screen {
-drawing-color1: rgb( 53, 132, 228);
-drawing-color2: rgb( 51, 209, 122);
-drawing-color3: rgb(246, 211, 45);
-drawing-color4: rgb(255, 120, 0);
-drawing-color5: rgb(224, 27, 36);
-drawing-color6: rgb(145, 65, 172);
-drawing-color7: rgb(152, 106, 68);
-drawing-color8: rgb(222, 221, 218);
-drawing-color9: rgb( 61, 56, 70);
}
*/
/* dark */
/*
.draw-on-your-screen {
-drawing-color1: rgb( 28, 113, 216);
-drawing-color2: rgb( 46, 194, 126);
-drawing-color3: rgb(245, 194, 17);
-drawing-color4: rgb(230, 97, 0);
-drawing-color5: rgb(192, 28, 40);
-drawing-color6: rgb(129, 61, 156);
-drawing-color7: rgb(134, 94, 60);
-drawing-color8: rgb(192, 191, 188);
-drawing-color9: rgb( 36, 31, 49);
}
*/
/* darker */
/*
.draw-on-your-screen {
-drawing-color1: rgb( 26, 095, 180);
-drawing-color2: rgb( 38, 162, 105);
-drawing-color3: rgb(229, 165, 10);
-drawing-color4: rgb(198, 70, 0);
-drawing-color5: rgb(165, 29, 45);
-drawing-color6: rgb( 97, 53, 131);
-drawing-color7: rgb( 99, 69, 44);
-drawing-color8: rgb(154, 153, 150);
-drawing-color9: rgb( 0, 0, 0);
}
*/

View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/tool-arc-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 14,1 C 13,1 13,2 13,2 13,2 12.941,4.04 12.701,4.6152 12.204,5.8094 11.214,7 8,7 4.2143,7 2.2036,8.8094 1.4512,10.615 1,11.698 1,14 1,14 1,14 1,15 2,15 3,15 3,14 3,14 3,14 2.9373,12.253 3.2988,11.385 3.7964,10.191 4.7857,9 8,9 11.786,9 13.796,7.1906 14.549,5.3848 15.045,4.1955 15,2 15,2 15,2 15,1 14,1 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 604 B

View File

@ -7,7 +7,7 @@ Created by potrace 1.15, written by Peter Selinger 2001-2017
https://svgsilh.com/image/1745699.html
https://creativecommons.org/publicdomain/zero/1.0
</metadata>
<g fill="#555" stroke="none">
<g fill="#474747">
<path d="M63.3 115.3 c-8.1 -9.8 -16.3 -21.4 -22.0 -31.2 -7.3 -12.5 -11.6
-23.5 -12.7 -32.2 -0.7 -5.2 -0.3 -9.1 1.3 -14.3 1.2 -4.0 3.1 -7.8 5.5 -11.5
1.6 -2.4 3.0 -4.1 5.1 -6.2 3.1 -3.1 5.7 -5.0 9.3 -6.8 3.8 -1.9 7.5 -3.0

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 851 B

View File

@ -1,5 +1,5 @@
<svg viewBox="0 0 576 576" xmlns="http://www.w3.org/2000/svg">
<rect fill="#555" stroke="transparent" x="228" y="228" width="120" height="120"/>
<rect fill="#555" stroke="transparent" x="50" y="228" width="120" height="120"/>
<rect fill="#555" stroke="transparent" x="406" y="228" width="120" height="120"/>
<rect fill="#474747" x="228" y="228" width="120" height="120"/>
<rect fill="#474747" x="50" y="228" width="120" height="120"/>
<rect fill="#474747" x="406" y="228" width="120" height="120"/>
</svg>

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 267 B

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/document-export-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 3,15 C 3,15 2,15 2,14 V 11 2 C 2,1 3,1 3,1 H 13 C 13,1 14,1 14,2 V 6.25 L 12,5 V 3.01 H 4 V 13 H 12 V 11 L 14,9.75 V 14 C 14,14 14,15 13,15 Z"/>
<path fill="#474747" d="M 10,11 V 9 H 6 V 7 H 10 V 5 L 14.5,8 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 517 B

View File

@ -1,3 +1,3 @@
<svg viewBox="-50 -130 740 740" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<ellipse fill="#555" stroke="transparent" cx="320" cy="240" rx="320" ry="240"/>
<ellipse fill="#474747" cx="320" cy="240" rx="320" ry="240"/>
</svg>

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 178 B

View File

@ -1,3 +1,3 @@
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<polygon fill="#555" stroke="transparent" fill-rule="evenodd" points="100,10 40,190 190,74 10,74 160,190"/>
<polygon fill="#474747" fill-rule="evenodd" points="100,10 40,190 190,74 10,74 160,190"/>
</svg>

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 201 B

View File

@ -1,3 +1,3 @@
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<polygon fill="#555" stroke="transparent" fill-rule="nonzero" points="100,10 40,190 190,74 10,74 160,190"/>
<polygon fill="#474747" fill-rule="nonzero" points="100,10 40,190 190,74 10,74 160,190"/>
</svg>

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 201 B

View File

@ -1,3 +1,3 @@
<svg viewBox="0 0 576 576" xmlns="http://www.w3.org/2000/svg">
<rect fill="#555" stroke="transparent" x="50" y="228" width="476" height="120"/>
<rect fill="#474747" x="50" y="228" width="476" height="120"/>
</svg>

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 135 B

View File

@ -1,4 +1,4 @@
<svg viewBox="0 0 576 576" xmlns="http://www.w3.org/2000/svg">
<rect fill="#555" stroke="transparent" x="50" y="178" width="350" height="220"/>
<ellipse fill="#555" stroke="transparent" cx="400" cy="288" rx="130" ry="110"/>
<rect fill="#474747" x="50" y="178" width="350" height="220"/>
<ellipse fill="#474747" cx="400" cy="288" rx="130" ry="110"/>
</svg>

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 199 B

View File

@ -1,3 +1,3 @@
<svg viewBox="-50 -50 676 676" xmlns="http://www.w3.org/2000/svg">
<path fill="#555" stroke="transparent" d="M -13 518 L288 0 L589 518 L500 576 L288 217 L76 576z"/>
<path fill="#474747" d="M -13 518 L288 0 L589 518 L500 576 L288 217 L76 576z"/>
</svg>

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 156 B

View File

@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
https://svgsilh.com/image/2026954.html
https://creativecommons.org/publicdomain/zero/1.0/
</metadata>
<g transform="translate(0,128) scale(1,-1)" fill="#474747">
<path d="M61.4 111.9 c-11.9 -0.8 -22.5 -5.4 -30.9 -13.6 -7.6 -7.5 -12.5
-17 -14 -27.4 -0.4 -2.6 -0.5 -3.8 -0.5 -7 0 -4.4 0.4 -7.6 1.4 -11.7 0.9
-3.5 1.8 -6 3.5 -9.5 1.9 -3.8 3.6 -6.5 6.4 -9.8 1.2 -1.4 4.6 -4.8 6.2
-6.1 7.1 -5.8 15.4 -9.4 24.4 -10.6 3.1 -0.4 6.9 -0.5 8 -0.2 1.8 0.5 3.3 1.4
4.3 2.8 1.3 1.6 1.9 3.5 1.8 5.6 -0.1 2 -0.7 3.3 -2.2 5.1 -0.7 0.8 -1.4 2.2
-1.6 3.2 -0.3 1 -0.3 2.9 0 3.8 0.6 2.4 2.3 4.4 4.5 5.4 1.5 0.7 1.4 0.7 8.9 0.8
3.7 0 6.9 0.1 7 0.1 0.1 0 0.7 0.1 1.3 0.2 5.4 0.9 10.5 3.5 14.5 7.5 3.2 3.3 5.4
6.9 6.7 11.3 1.1 3.6 1.3 8.1 0.7 12.7 -1.9 13.4 -10.7 25.1 -23.8 31.8 -5.8
3 -12 4.7 -18.7 5.4 -1.5 0.2 -6.5 0.3 -7.9 0.2z m-8.4 -10.9 c2.7 -0.9 4.7
-3 5.5 -5.7 0.3 -1.1 0.3 -2.9 0 -4 -0.7 -2.8 -3 -5 -5.8 -5.8 -1.1 -0.3
-2.8 -0.3 -3.9 0 -2.8 0.7 -4.8 2.7 -5.7 5.5 -0.3 0.9 -0.4 2.7 -0.2 3.7 0.5 3.1 3
5.7 6.1 6.4 0.9 0.2 3.1 0.1 4 -0.2z m26 0.2 c3.2 -0.7 5.7 -3.3 6.2 -6.4 0.2
-1 0.1 -2.8 -0.2 -3.7 -0.9 -2.8 -2.9 -4.7 -5.7 -5.5 -1.1 -0.3 -2.8 -0.3 -3.9 0
-2.8 0.7 -5 2.3 -5.8 5.8 -0.3 1.1 -0.3 2.9 0 4 0.8 3 3.2 5.3 6.2 5.9 0.7
0.1 2.4 0.1 3.2 0z m-43.1 -21.3 c1.8 -0.3 3.1 -1 4.5 -2.3 1.3 -1.3 2 -2.7
2.3 -4.6 0.3 -2.5 -0.6 -5 -2.5 -6.7 -1 -0.9 -2 -1.5 -3.4 -1.9 -1 -0.3
-3 -0.3 -4 0 -3.6 1 -6 4.1 -6 7.8 0 1.7 0.4 3.1 1.3 4.4 1.8 2.6 4.9
4 7.9 3.5z m59.6 -0.2 c3.5 -1 5.8 -4.1 5.8 -7.7 0 -1.7 -0.4 -3 -1.3 -4.3
-2.5 -3.9 -7.7 -4.8 -11.5 -2.1 -1.2 0.9 -2.4 2.5 -2.9 4 -0.9 2.7 -0.2 5.8
1.8 7.9 1.2 1.3 2.7 2.1 4.4 2.5 1 0.2 2.7 0.1 3.6 -0.2z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,6 +1,6 @@
<svg viewBox="0 0 576 576" xmlns="http://www.w3.org/2000/svg">
<rect fill="#555" stroke="none" x="99.06" y="116.46" width="426.79" height="88.9" transform="translate(-1.13,-26.30) translate(297.56,177.87) rotate(-17.00) translate(-297.56,-177.87) translate(-14.89,16.96)"/>
<rect fill="#555" stroke="none" x="382.92" y="219.17" width="137.39" height="55" transform="translate(-7.43,-27.23) translate(449.62,218.30) rotate(-16.48) translate(-449.62,-218.30) translate(-2,-19.20)"/>
<rect fill="#555" stroke="none" x="99.06" y="116.46" width="426.79" height="88.9" transform="translate(0, 284.75) rotate(180) scale(1, -1) rotate(-180) translate(0, -284.75) translate(-1.13,-26.30) translate(297.56,177.87) rotate(-17.00) translate(-297.56,-177.87) translate(-14.89,16.96)"/>
<rect fill="#555" stroke="none" x="382.92" y="219.17" width="137.39" height="55" transform="translate(0, 284.02) rotate(180) scale(1, -1) rotate(-180) translate(0, -284.02) translate(-7.43,-27.23) translate(449.62,218.30) rotate(-16.48) translate(-449.62,-218.30) translate(-2,-19.20)"/>
<rect fill="#474747" x="99.06" y="116.46" width="426.79" height="88.9" transform="translate(296.43,151.57) rotate(-17.00) translate(-312.45,-160.91)"/>
<rect fill="#474747" x="382.92" y="219.17" width="137.39" height="55" transform="translate(442.19,191.07) rotate(-16.48) translate(-451.62,-237.50)"/>
<rect fill="#474747" x="99.06" y="116.46" width="426.79" height="88.9" transform="translate(0, 284.75) rotate(180) scale(1, -1) rotate(-180) translate(296.43,-133.18) rotate(-17.00) translate(-312.45,-160.91)"/>
<rect fill="#474747" x="382.92" y="219.17" width="137.39" height="55" transform="translate(0, 284.02) rotate(180) scale(1, -1) rotate(-180) translate(442.19,-92.95) rotate(-16.48) translate(-451.62,-237.50)"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 803 B

View File

@ -1,3 +1,3 @@
<svg viewBox="-50 -130 740 740" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<path stroke="transparent" fill="#555" d="m4,239.99861l0,0c0,-130.70635 141.47749,-236.66527 315.99786,-236.66527l0,0c83.80939,0 164.18481,24.93385 223.44586,69.31971c59.2608,44.38261 92.55627,104.57763 92.55627,167.34556l0,0c0,130.70897 -141.47833,236.66808 -316.00214,236.66808l0,0c-174.52037,0 -315.99786,-105.95911 -315.99786,-236.66808zm158.00044,0l0,0c0,65.35454 70.73923,118.33434 157.99742,118.33434c87.26294,0 158.00085,-52.9798 158.00085,-118.33434c0,-65.35178 -70.73792,-118.33152 -158.00085,-118.33152l0,0c-87.25819,0 -157.99742,52.97974 -157.99742,118.33152z"/>
<path fill="#474747" d="m4,239.99861l0,0c0,-130.70635 141.47749,-236.66527 315.99786,-236.66527l0,0c83.80939,0 164.18481,24.93385 223.44586,69.31971c59.2608,44.38261 92.55627,104.57763 92.55627,167.34556l0,0c0,130.70897 -141.47833,236.66808 -316.00214,236.66808l0,0c-174.52037,0 -315.99786,-105.95911 -315.99786,-236.66808zm158.00044,0l0,0c0,65.35454 70.73923,118.33434 157.99742,118.33434c87.26294,0 158.00085,-52.9798 158.00085,-118.33434c0,-65.35178 -70.73792,-118.33152 -158.00085,-118.33152l0,0c-87.25819,0 -157.99742,52.97974 -157.99742,118.33152z"/>
</svg>

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 673 B

View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/tool-circle-move-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 8,1 A 7,7 0 0 0 1,8 7,7 0 0 0 8,15 7,7 0 0 0 15,8 7,7 0 0 0 8,1 Z M 8,3 A 5,5 0 0 1 13,8 5,5 0 0 1 8,13 5,5 0 0 1 3,8 5,5 0 0 1 8,3 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 442 B

View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/tool-line-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 12.778,13.778 C 12.778,13.778 13.278,14.278 13.778,13.778 14.278,13.278 13.778,12.778 13.778,12.778 L 3.2237,2.2237 C 3.2237,2.2237 2.7237,1.7237 2.2237,2.2237 1.7237,2.7237 2.2237,3.2237 2.2237,3.2237 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/view-mirror-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 1.8613,0 C 1.0809,0 0,0.69182 0,1.5762 V 14.387 C 0,15.271 1.0809,16 1.8613,16 L 5.752,13.053 C 6.3603,12.597 7,12.324 7,11.439 V 4.5254 C 7,3.6409 6.188,3.303 5.752,2.9121 Z M 2,1.3535 5.8516,4.2598 C 5.8516,4.2598 6,4.328 6,4.5254 V 11.439 C 6,11.699 5.8984,11.699 5.8984,11.699 L 2,14.641 Z"/>
<path fill="#474747" opacity="0.3" d="M 13.139,0 C 13.919,0 15,0.69182 15,1.5762 V 14.387 C 15,15.271 13.919,16 13.139,16 L 9.248,13.053 C 8.6397,12.597 8,12.324 8,11.439 V 4.5254 C 8,3.6409 8.812,3.303 9.248,2.9121 Z M 13,1.3535 9.1484,4.2598 C 9.1484,4.2598 9,4.328 9,4.5254 V 11.439 C 9,11.699 9.1016,11.699 9.1016,11.699 L 13,14.641 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 940 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">
<metadata>
Combination of https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/object-move-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
and https://gitlab.gnome.org/World/design/icon-library/-/blob/master/data/resources/icon-dev-kit/rotate-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
optimized with SVGO
</metadata>
<path d="M8 15.5L5 12h2v-2h2v2h2zM.5 8L4 5v2h2v2H4v2z" fill="#474747"/>
<a transform="rotate(-4.342 5.603 3.916)">
<path fill="#474747" d="M8.672.954l-3.654 3.2c.634.717 1.341 1.557 1.92 2.193l1.28 1.46.166-2.484.022-.02c.769-.196 1.74.097 2.457.915 1.102 1.259.67 2.758-.634 3.9l.57.674c.346.407 1.058.4 1.396-.012 1.65-1.444 1.556-4.028.037-5.763-.986-1.124-2.398-1.707-3.725-1.579z"/>
</a>
</svg>

After

Width:  |  Height:  |  Size: 903 B

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 920.729 920.729">
<metadata>
Combination of https://www.svgrepo.com/svg/150374/pencil
https://creativecommons.org/publicdomain/zero/1.0/deed.en
and https://www.svgrepo.com/svg/29291/pencil
https://creativecommons.org/publicdomain/zero/1.0/deed.en
</metadata>
<g fill="#474747">
<path d="m 823.25922,841.48926 c -1.399,0 -2.699,0.1 -4.1,0.3 l -245.7,31.8 c -12.6,1.601 -21.399,-12.2 -14.6,-23 3.7,-5.7 7.3,-11.5 10.899,-17.3 9.5,-15.4 -3.199,-35.9 -20.8,-35.9 -1.2,0 -2.399,0.101 -3.7,0.301 l -322,48.399 -38.5,5.8 -104.999997,15.801 c -11.9,1.8 -19.9,11.899 -18.9,24 0.4,5.399 2.6,10.5 6.1,14.3 4.1,4.5 9.8,7 16,7 1.2,0 2.4,-0.101 3.7,-0.3 l 383.799997,-57.7 c 13.101,-2 22.101,12.8 14.4,23.6 -2.5,3.4 -5,6.9 -7.5,10.3 -6.9,9.4 -5.3,25.101 2.7,33.2 4.1,4.2 9.3,6.4 14.8,6.4 0.6,0 1.3,0 1.899,-0.101 h 0.101 0.1 l 331.3,-42.199 h 0.101 0.1 c 5.7,-0.9 10.7,-4.2 14,-9.301 3.601,-5.6 4.9,-12.5 3.3,-18.699 -2.6,-10.101 -11.4,-16.701 -22.5,-16.701 z"/>
<g transform="translate(58.371053,4.3729293)">
<path d="m 515.582,157.916 -439.199,439.2 4.6,10.1 27.1,58.8 41.6,22 c 9.8,5.2 17.7,13.101 22.9,22.9 l 22,41.6 58.8,27.101 10.101,4.6 439.2,-439.2 z"/>
<path d="m 853.282,159.216 -151.8,-151.8 c -4.9,-4.9 -11.3,-7.3 -17.7,-7.3 -6.4,0 -12.8,2.4 -17.7,7.3 l -129.3,129.3 187.2,187.2 129.3,-129.3 c 9.8,-9.8 9.8,-25.6 0,-35.4 z"/>
<path d="m 46.083,650.016 -4.3,16.9 -41,162.5 c -4.1,16.2 8.5,31.1 24.1,31.1 2,0 4.1,-0.3 6.2,-0.8 l 162.5,-41 16.9,-4.3 16.9,-4.3 13.3,-3.4 -30.9,-14.2 -29.5,-13.5 c -5,-2.3 -9.1,-6.199 -11.7,-11 l -18.6,-35.1 -4.3,-8 c -2.3,-4.4 -6,-8.1 -10.4,-10.4 l -8,-4.3 -35.1,-18.6 c -4.9,-2.601 -8.7,-6.7 -11,-11.7 l -13.5,-29.5 -14.2,-30.9 -3.4,13.301 z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/tool-polygon-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 12.98,2.5 1.9551,3.502 1.5,4 V 14 L 2.3203,14.385 8.0684,9.5938 13.777,12.447 14.496,11.945 13.496,2.9453 Z M 12.557,3.543 13.402,11.143 8.2227,8.5527 7.6797,8.6152 2.5,12.932 V 4.457 Z"/>
<path fill="#474747" d="M 10,9 A 2,2 0 0 1 8,11 2,2 0 0 1 6,9 2,2 0 0 1 8,7 2,2 0 0 1 10,9 Z M 4,4 A 2,2 0 0 1 2,6 2,2 0 0 1 0,4 2,2 0 0 1 2,2 2,2 0 0 1 4,4 Z M 4,14 A 2,2 0 0 1 2,16 2,2 0 0 1 0,14 2,2 0 0 1 2,12 2,2 0 0 1 4,14 Z M 16,12 A 2,2 0 0 1 14,14 2,2 0 0 1 12,12 2,2 0 0 1 14,10 2,2 0 0 1 16,12 Z M 15,3 A 2,2 0 0 1 13,5 2,2 0 0 1 11,3 2,2 0 0 1 13,1 2,2 0 0 1 15,3 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 871 B

View File

@ -0,0 +1,9 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<rect fill="#474747" x="98" y="204" width="226" height="40" transform="translate(116,253) rotate(-66) translate(-211,-226)"/>
<rect fill="#474747" x="145" y="339" width="270" height="40" transform="translate(236,262) rotate(58) translate(-280,-362)"/>
<rect fill="#474747" x="141" y="429" width="211" height="40" transform="translate(374,300) rotate(-47) translate(-246,-451)"/>
<circle fill="#474747" cx="166" cy="172" r="55"/>
<circle fill="#474747" cx="166" cy="172" r="55" transform="translate(143,190)"/>
<circle fill="#474747" cx="166" cy="172" r="55" transform="translate(-87,168)"/>
<circle fill="#474747" cx="166" cy="172" r="55" transform="translate(273,56)"/>
</svg>

After

Width:  |  Height:  |  Size: 755 B

View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<metadata>
https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/blob/master/Papirus/symbolic/actions/tool-rectangle-symbolic.svg
https://www.gnu.org/licenses/gpl-3.0.html
</metadata>
<path fill="#474747" d="M 1,1 V 15 H 15 V 1 Z M 3,3 H 13 V 13 H 3 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 348 B

View File

@ -0,0 +1,15 @@
<svg width="16" height="16">
<metadata>
https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/blob/master/Adwaita/scalable/actions/view-fullscreen-symbolic.svg
https://creativecommons.org/licenses/by-sa/3.0/
</metadata>
<g fill="#474747">
<path d="M1.984 8.986A1 1 0 0 0 1 10v4a1 1 0 0 0 1 1h4a1 1 0 1 0 0-2H3v-3a1 1 0 0 0-1.016-1.014z" />
<path d="M6.48 8.49a1 1 0 0 0-.687.303l-4.5 4.5a1 1 0 1 0 1.414 1.414l4.5-4.5A1 1 0 0 0 6.48 8.49z" />
<path d="M1 14h1v1H1z" />
<path d="M10 1a1 1 0 1 0 0 2h3v3a1 1 0 1 0 2 0V2a1 1 0 0 0-1-1z" />
<path d="M14 1h1v1h-1z" />
<path d="M13.984.99a1 1 0 0 0-.69.301l-4.5 4.469a1 1 0 1 0 1.411 1.418l4.5-4.469a1 1 0 0 0-.72-1.719z" />
<path d="M1 9h1v1H1zM6 14h1v1H6zM14 6h1v1h-1zM9 1h1v1H9z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 773 B

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,9 @@
/* jslint esversion: 6 */
/*
* Copyright 2019 Abakkk
*
* This file is part of DrawOnYourScreen, a drawing extension for GNOME Shell.
* https://framagit.org/abakkk/DrawOnYourScreen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ -18,130 +13,148 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-FileCopyrightText: 2019 Abakkk
* SPDX-License-Identifier: GPL-3.0-or-later
*/
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
/* jslint esversion: 6 */
/* exported init */
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Config = imports.misc.config;
const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main;
const OsdWindow = imports.ui.osdWindow;
const PanelMenu = imports.ui.panelMenu;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = ExtensionUtils.getSettings && ExtensionUtils.initTranslations ? ExtensionUtils : Me.imports.convenience;
const Area = Me.imports.area;
const Files = Me.imports.files;
const Helper = Me.imports.helper;
const _ = imports.gettext.domain(Me.metadata['gettext-domain']).gettext;
const GS_VERSION = Config.PACKAGE_VERSION;
const HIDE_TIMEOUT_LONG = 2500; // ms, default is 1500 ms
const UUID = Me.uuid.replace(/@/gi, '_at_').replace(/[^a-z0-9+_-]/gi, '_');
// custom Shell.ActionMode, assuming that they are unused
const DRAWING_ACTION_MODE = Math.pow(2,14);
const WRITING_ACTION_MODE = Math.pow(2,15);
// use 'login-dialog-message-warning' class in order to get GS theme warning color (default: #f57900)
var WARNING_COLOR_STYLE_CLASS_NAME = 'login-dialog-message-warning';
var manager;
const WARNING_COLOR_STYLE_CLASS_NAME = 'login-dialog-message-warning';
function init() {
return new Extension();
}
const Extension = new Lang.Class({
Name: `${UUID}-Extension`,
_init: function() {
Convenience.initTranslations();
}
},
function enable() {
manager = new AreaManager();
}
enable() {
if (ExtensionUtils.isOutOfDate(Me))
log(`${Me.metadata.uuid}: GNOME Shell ${Number.parseFloat(GS_VERSION)} is not supported.`);
function disable() {
manager.disable();
manager = null;
}
Me.settings = Convenience.getSettings();
Me.internalShortcutSettings = Convenience.getSettings(Me.metadata['settings-schema'] + '.internal-shortcuts');
Me.drawingSettings = Convenience.getSettings(Me.metadata['settings-schema'] + '.drawing');
this.areaManager = new AreaManager();
},
disable() {
this.areaManager.disable();
delete this.areaManager;
delete Me.settings;
delete Me.internalShortcutSettings;
}
});
// AreaManager assigns one DrawingArea per monitor (updateAreas()),
// distributes keybinding callbacks to the active area
// and handles stylesheet and monitor changes.
var AreaManager = new Lang.Class({
Name: 'DrawOnYourScreenAreaManager',
const AreaManager = new Lang.Class({
Name: `${UUID}-AreaManager`,
_init: function() {
this.settings = Convenience.getSettings();
this.areas = [];
this.activeArea = null;
this.enterGicon = new Gio.ThemedIcon({ name: 'applications-graphics-symbolic' });
this.leaveGicon = new Gio.ThemedIcon({ name: 'application-exit-symbolic' });
Main.wm.addKeybinding('toggle-drawing',
this.settings,
Me.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
this.toggleDrawing.bind(this));
Main.wm.addKeybinding('toggle-modal',
this.settings,
Me.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
this.toggleModal.bind(this));
Main.wm.addKeybinding('erase-drawing',
this.settings,
Main.wm.addKeybinding('erase-drawings',
Me.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
this.eraseDrawing.bind(this));
this.eraseDrawings.bind(this));
this.updateAreas();
this.monitorChangedHandler = Main.layoutManager.connect('monitors-changed', this.updateAreas.bind(this));
this.updateIndicator();
this.indicatorSettingHandler = this.settings.connect('changed::indicator-disabled', this.updateIndicator.bind(this));
this.indicatorSettingHandler = Me.settings.connect('changed::indicator-disabled', this.updateIndicator.bind(this));
this.desktopSettingHandler = this.settings.connect('changed::drawing-on-desktop', this.onDesktopSettingChanged.bind(this));
this.persistentSettingHandler = this.settings.connect('changed::persistent-drawing', this.onPersistentSettingChanged.bind(this));
this.desktopSettingHandler = Me.settings.connect('changed::drawing-on-desktop', this.onDesktopSettingChanged.bind(this));
this.persistentOverRestartsSettingHandler = Me.settings.connect('changed::persistent-over-restarts', this.onPersistentOverRestartsSettingChanged.bind(this));
this.persistentOverTogglesSettingHandler = Me.settings.connect('changed::persistent-over-toggles', this.onPersistentOverTogglesSettingChanged.bind(this));
},
this.userStyleFile = Gio.File.new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), Me.metadata['data-dir'], 'user.css']));
get persistentOverToggles() {
return Me.settings.get_boolean('persistent-over-toggles');
},
if (this.userStyleFile.query_exists(null)) {
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
theme.load_stylesheet(this.userStyleFile);
}
get persistentOverRestarts() {
return Me.settings.get_boolean('persistent-over-toggles') && Me.settings.get_boolean('persistent-over-restarts');
},
this.userStyleMonitor = this.userStyleFile.monitor_file(Gio.FileMonitorFlags.WATCH_MOVES, null);
this.userStyleHandler = this.userStyleMonitor.connect('changed', (monitor, file, otherFile, eventType) => {
// 'CHANGED' events are followed by a 'CHANGES_DONE_HINT' event
if (eventType == Gio.FileMonitorEvent.CHANGED || eventType == Gio.FileMonitorEvent.ATTRIBUTE_CHANGED)
return;
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
if (theme.get_custom_stylesheets().indexOf(this.userStyleFile) != -1)
theme.unload_stylesheet(this.userStyleFile);
if (this.userStyleFile.query_exists(null))
theme.load_stylesheet(this.userStyleFile);
});
get onDesktop() {
return Me.settings.get_boolean('persistent-over-toggles') && Me.settings.get_boolean('drawing-on-desktop');
},
onDesktopSettingChanged: function() {
if (this.settings.get_boolean("drawing-on-desktop"))
this.areas.forEach(area => area.get_parent().show());
if (this.onDesktop)
this.areas.forEach(area => area.show());
else
this.areas.forEach(area => area.get_parent().hide());
this.areas.forEach(area => area.hide());
},
onPersistentSettingChanged: function() {
if (this.settings.get_boolean('persistent-drawing'))
onPersistentOverRestartsSettingChanged: function() {
if (this.persistentOverRestarts)
this.areas[Main.layoutManager.primaryIndex].syncPersistent();
},
onPersistentOverTogglesSettingChanged: function() {
if (!this.persistentOverToggles && !this.activeArea)
this.eraseDrawings();
this.onPersistentOverRestartsSettingChanged();
this.onDesktopSettingChanged();
},
updateIndicator: function() {
if (this.indicator) {
this.indicator.disable();
this.indicator = null;
}
if (!this.settings.get_boolean('indicator-disabled'))
if (!Me.settings.get_boolean('indicator-disabled'))
this.indicator = new DrawingIndicator();
},
@ -154,24 +167,26 @@ var AreaManager = new Lang.Class({
for (let i = 0; i < this.monitors.length; i++) {
let monitor = this.monitors[i];
let container = new St.Widget({ name: 'drawOnYourSreenContainer' + i });
let helper = new Helper.DrawingHelper({ name: 'drawOnYourSreenHelper' + i }, monitor);
let loadPersistent = i == Main.layoutManager.primaryIndex && this.settings.get_boolean('persistent-drawing');
let area = new Area.DrawingArea({ name: 'drawOnYourSreenArea' + i }, monitor, helper, loadPersistent);
container.add_child(area);
container.add_child(helper);
let loadPersistent = i == Main.layoutManager.primaryIndex && this.persistentOverRestarts;
// Some utils for the drawing area menus.
let areaManagerUtils = {
getHiddenList: () => this.hiddenList || null,
togglePanelAndDockOpacity: this.togglePanelAndDockOpacity.bind(this),
openPreferences: this.openPreferences.bind(this)
};
let area = new Area.DrawingArea({ name: 'drawOnYourSreenArea' + i }, monitor, helper, areaManagerUtils, loadPersistent);
Main.layoutManager._backgroundGroup.insert_child_above(container, Main.layoutManager._bgManagers[i].backgroundActor);
if (!this.settings.get_boolean("drawing-on-desktop"))
container.hide();
Main.layoutManager._backgroundGroup.insert_child_above(area, Main.layoutManager._bgManagers[i].backgroundActor);
if (!this.onDesktop)
area.hide();
container.set_position(monitor.x, monitor.y);
container.set_size(monitor.width, monitor.height);
area.set_position(monitor.x, monitor.y);
area.set_size(monitor.width, monitor.height);
area.leaveDrawingHandler = area.connect('leave-drawing-mode', this.toggleDrawing.bind(this));
area.updateActionModeHandler = area.connect('update-action-mode', this.updateActionMode.bind(this));
area.pointerCursorChangedHandler = area.connect('pointer-cursor-changed', this.setCursor.bind(this));
area.showOsdHandler = area.connect('show-osd', this.showOsd.bind(this));
area.showOsdGiconHandler = area.connect('show-osd-gicon', this.showOsd.bind(this));
this.areas.push(area);
}
},
@ -187,48 +202,52 @@ var AreaManager = new Lang.Class({
'decrement-line-width': () => this.activeArea.incrementLineWidth(-1),
'increment-line-width-more': () => this.activeArea.incrementLineWidth(5),
'decrement-line-width-more': () => this.activeArea.incrementLineWidth(-5),
'paste-image-files': this.activeArea.pasteImageFiles.bind(this.activeArea),
'switch-linejoin': this.activeArea.switchLineJoin.bind(this.activeArea),
'switch-linecap': this.activeArea.switchLineCap.bind(this.activeArea),
'switch-fill-rule': this.activeArea.switchFillRule.bind(this.activeArea),
'switch-dash' : this.activeArea.switchDash.bind(this.activeArea),
'switch-fill' : this.activeArea.switchFill.bind(this.activeArea),
'switch-image-file' : this.activeArea.switchImageFile.bind(this.activeArea),
'select-none-shape': () => this.activeArea.selectTool(Area.Tools.NONE),
'select-line-shape': () => this.activeArea.selectTool(Area.Tools.LINE),
'select-ellipse-shape': () => this.activeArea.selectTool(Area.Tools.ELLIPSE),
'select-rectangle-shape': () => this.activeArea.selectTool(Area.Tools.RECTANGLE),
'select-text-shape': () => this.activeArea.selectTool(Area.Tools.TEXT),
'select-image-shape': () => this.activeArea.selectTool(Area.Tools.IMAGE),
'select-polygon-shape': () => this.activeArea.selectTool(Area.Tools.POLYGON),
'select-polyline-shape': () => this.activeArea.selectTool(Area.Tools.POLYLINE),
'select-move-tool': () => this.activeArea.selectTool(Area.Tools.MOVE),
'select-resize-tool': () => this.activeArea.selectTool(Area.Tools.RESIZE),
'select-mirror-tool': () => this.activeArea.selectTool(Area.Tools.MIRROR)
'switch-image-file' : this.activeArea.switchImageFile.bind(this.activeArea, false),
'switch-image-file-reverse' : this.activeArea.switchImageFile.bind(this.activeArea, true),
'select-none-shape': () => this.activeArea.selectTool(Area.Tool.NONE),
'select-line-shape': () => this.activeArea.selectTool(Area.Tool.LINE),
'select-ellipse-shape': () => this.activeArea.selectTool(Area.Tool.ELLIPSE),
'select-rectangle-shape': () => this.activeArea.selectTool(Area.Tool.RECTANGLE),
'select-text-shape': () => this.activeArea.selectTool(Area.Tool.TEXT),
'select-image-shape': () => this.activeArea.selectTool(Area.Tool.IMAGE),
'select-polygon-shape': () => this.activeArea.selectTool(Area.Tool.POLYGON),
'select-polyline-shape': () => this.activeArea.selectTool(Area.Tool.POLYLINE),
'select-move-tool': () => this.activeArea.selectTool(Area.Tool.MOVE),
'select-resize-tool': () => this.activeArea.selectTool(Area.Tool.RESIZE),
'select-mirror-tool': () => this.activeArea.selectTool(Area.Tool.MIRROR)
};
// available when writing
this.internalKeybindings2 = {
'save-as-svg': this.activeArea.saveAsSvg.bind(this.activeArea),
'save-as-json': this.activeArea.saveAsJson.bind(this.activeArea),
'export-to-svg': this.activeArea.exportToSvg.bind(this.activeArea),
'save-as-json': this.activeArea.saveAsJson.bind(this.activeArea, true, null),
'open-previous-json': this.activeArea.loadPreviousJson.bind(this.activeArea),
'open-next-json': this.activeArea.loadNextJson.bind(this.activeArea),
'pick-color': this.activeArea.pickColor.bind(this.activeArea),
'toggle-background': this.activeArea.toggleBackground.bind(this.activeArea),
'toggle-grid': this.activeArea.toggleGrid.bind(this.activeArea),
'toggle-square-area': this.activeArea.toggleSquareArea.bind(this.activeArea),
'reverse-switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea, true),
'switch-color-palette': this.activeArea.switchColorPalette.bind(this.activeArea, false),
'switch-color-palette-reverse': this.activeArea.switchColorPalette.bind(this.activeArea, true),
'switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea, false),
'switch-font-family-reverse': this.activeArea.switchFontFamily.bind(this.activeArea, true),
'switch-font-weight': this.activeArea.switchFontWeight.bind(this.activeArea),
'switch-font-style': this.activeArea.switchFontStyle.bind(this.activeArea),
'switch-text-alignment': this.activeArea.switchTextAlignment.bind(this.activeArea),
'toggle-panel-and-dock-visibility': this.togglePanelAndDockOpacity.bind(this),
'toggle-help': this.activeArea.toggleHelp.bind(this.activeArea),
'open-user-stylesheet': this.openUserStyleFile.bind(this),
'open-preferences': this.openPreferences.bind(this)
};
for (let key in this.internalKeybindings1) {
Main.wm.addKeybinding(key,
this.settings,
Me.internalShortcutSettings,
Meta.KeyBindingFlags.NONE,
DRAWING_ACTION_MODE,
this.internalKeybindings1[key]);
@ -236,7 +255,7 @@ var AreaManager = new Lang.Class({
for (let key in this.internalKeybindings2) {
Main.wm.addKeybinding(key,
this.settings,
Me.internalShortcutSettings,
Meta.KeyBindingFlags.NONE,
DRAWING_ACTION_MODE | WRITING_ACTION_MODE,
this.internalKeybindings2[key]);
@ -245,10 +264,10 @@ var AreaManager = new Lang.Class({
for (let i = 1; i < 10; i++) {
let iCaptured = i;
Main.wm.addKeybinding('select-color' + i,
this.settings,
Me.internalShortcutSettings,
Meta.KeyBindingFlags.NONE,
DRAWING_ACTION_MODE | WRITING_ACTION_MODE,
() => this.activeArea.selectColor(iCaptured));
this.activeArea.selectColor.bind(this.activeArea, iCaptured - 1));
}
},
@ -272,27 +291,10 @@ var AreaManager = new Lang.Class({
}
},
openUserStyleFile: function() {
if (!this.userStyleFile.query_exists(null)) {
if (!this.userStyleFile.get_parent().query_exists(null))
this.userStyleFile.get_parent().make_directory_with_parents(null);
let defaultStyleFile = Me.dir.get_child('data').get_child('default.css');
if (!defaultStyleFile.query_exists(null))
return;
let success = defaultStyleFile.copy(this.userStyleFile, Gio.FileCopyFlags.NONE, null, null);
if (!success)
return;
}
Gio.AppInfo.launch_default_for_uri(this.userStyleFile.get_uri(), global.create_app_launch_context(0, -1));
if (this.activeArea)
this.toggleDrawing();
},
eraseDrawing: function() {
eraseDrawings: function() {
for (let i = 0; i < this.areas.length; i++)
this.areas[i].erase();
if (this.settings.get_boolean('persistent-drawing'))
if (this.persistentOverRestarts)
this.areas[Main.layoutManager.primaryIndex].savePersistent();
},
@ -334,25 +336,24 @@ var AreaManager = new Lang.Class({
}
},
toggleContainer: function() {
toggleArea: function() {
if (!this.activeArea)
return;
let activeContainer = this.activeArea.get_parent();
let activeIndex = this.areas.indexOf(this.activeArea);
if (activeContainer.get_parent() == Main.uiGroup) {
if (this.activeArea.get_parent() == Main.uiGroup) {
Main.uiGroup.set_child_at_index(Main.layoutManager.keyboardBox, this.oldKeyboardIndex);
Main.uiGroup.remove_actor(activeContainer);
Main.layoutManager._backgroundGroup.insert_child_above(activeContainer, Main.layoutManager._bgManagers[activeIndex].backgroundActor);
if (!this.settings.get_boolean("drawing-on-desktop"))
activeContainer.hide();
Main.uiGroup.remove_actor(this.activeArea);
Main.layoutManager._backgroundGroup.insert_child_above(this.activeArea, Main.layoutManager._bgManagers[activeIndex].backgroundActor);
if (!this.onDesktop)
this.activeArea.hide();
} else {
Main.layoutManager._backgroundGroup.remove_actor(activeContainer);
Main.uiGroup.add_child(activeContainer);
Main.layoutManager._backgroundGroup.remove_actor(this.activeArea);
Main.uiGroup.add_child(this.activeArea);
// move the keyboard above the area to make it available with text entries
this.oldKeyboardIndex = Main.uiGroup.get_children().indexOf(Main.layoutManager.keyboardBox);
Main.uiGroup.set_child_above_sibling(Main.layoutManager.keyboardBox, activeContainer);
Main.uiGroup.set_child_above_sibling(Main.layoutManager.keyboardBox, this.activeArea);
}
},
@ -365,8 +366,9 @@ var AreaManager = new Lang.Class({
if (Main._findModal(this.activeArea) != -1) {
Main.popModal(this.activeArea);
if (source && source == global.display)
this.showOsd(null, 'touchpad-disabled-symbolic', _("Keyboard and pointer released"), null, null, false);
setCursor('DEFAULT');
// Translators: "released" as the opposite of "grabbed"
this.showOsd(null, Files.Icons.UNGRAB, _("Keyboard and pointer released"), null, null, false);
this.setCursor(null, 'DEFAULT');
this.activeArea.reactive = false;
this.removeInternalKeybindings();
} else {
@ -378,7 +380,7 @@ var AreaManager = new Lang.Class({
this.activeArea.reactive = true;
this.activeArea.initPointerCursor();
if (source && source == global.display)
this.showOsd(null, 'input-touchpad-symbolic', _("Keyboard and pointer grabbed"), null, null, false);
this.showOsd(null, Files.Icons.GRAB, _("Keyboard and pointer grabbed"), null, null, false);
}
return true;
@ -387,32 +389,35 @@ var AreaManager = new Lang.Class({
toggleDrawing: function() {
if (this.activeArea) {
let activeIndex = this.areas.indexOf(this.activeArea);
let save = activeIndex == Main.layoutManager.primaryIndex && this.settings.get_boolean('persistent-drawing');
let save = activeIndex == Main.layoutManager.primaryIndex && this.persistentOverRestarts;
let erase = !this.persistentOverToggles;
this.showOsd(null, this.leaveGicon, _("Leaving drawing mode"));
this.activeArea.leaveDrawingMode(save);
this.showOsd(null, Files.Icons.LEAVE, _("Leaving drawing mode"));
this.activeArea.leaveDrawingMode(save, erase);
if (this.hiddenList)
this.togglePanelAndDockOpacity();
if (Main._findModal(this.activeArea) != -1)
this.toggleModal();
this.toggleContainer();
this.toggleArea();
this.activeArea = null;
} else {
// avoid to deal with Meta changes (global.display/global.screen)
let currentIndex = Main.layoutManager.monitors.indexOf(Main.layoutManager.currentMonitor);
this.activeArea = this.areas[currentIndex];
this.toggleContainer();
this.toggleArea();
if (!this.toggleModal()) {
this.toggleContainer();
this.toggleArea();
this.activeArea = null;
return;
}
this.activeArea.enterDrawingMode();
this.osdDisabled = this.settings.get_boolean('osd-disabled');
let label = _("<small>Press <i>%s</i> for help</small>").format(this.activeArea.helper.helpKeyLabel) + "\n\n" + _("Entering drawing mode");
this.showOsd(null, this.enterGicon, label, null, null, true);
this.osdDisabled = Me.settings.get_boolean('osd-disabled');
// <span size="medium"> is a clutter/mutter 3.38 bug workaround: https://gitlab.gnome.org/GNOME/mutter/-/issues/1467
// Translators: %s is a key label
let label = `<small>${_("Press <i>%s</i> for help").format(this.activeArea.helper.helpKeyLabel)}</small>\n\n<span size="medium">${_("Entering drawing mode")}</span>`;
this.showOsd(null, Files.Icons.ENTER, label, null, null, true);
}
if (this.indicator)
@ -446,10 +451,8 @@ var AreaManager = new Lang.Class({
if (level && GS_VERSION > '3.33.0')
level = level / 100;
if (icon && typeof icon == 'string')
icon = new Gio.ThemedIcon({ name: icon });
else if (!icon)
icon = this.enterGicon;
if (!icon)
icon = Files.Icons.ENTER;
let osdWindow = Main.osdWindowManager._osdWindows[activeIndex];
@ -503,52 +506,55 @@ var AreaManager = new Lang.Class({
OsdWindow.HIDE_TIMEOUT = hideTimeoutSave;
},
setCursor: function(sourceActor_, cursorName) {
// check display or screen (API changes)
if (global.display.set_cursor)
global.display.set_cursor(Meta.Cursor[cursorName]);
else if (global.screen && global.screen.set_cursor)
global.screen.set_cursor(Meta.Cursor[cursorName]);
},
removeAreas: function() {
for (let i = 0; i < this.areas.length; i++) {
let area = this.areas[i];
area.disconnect(area.leaveDrawingHandler);
area.disconnect(area.updateActionModeHandler);
area.disconnect(area.showOsdHandler);
area.disconnect(area.showOsdGiconHandler);
let container = area.get_parent();
container.get_parent().remove_actor(container);
container.destroy();
area.destroy();
}
this.areas = [];
},
disable: function() {
if (this.userStyleHandler && this.userStyleMonitor) {
this.userStyleMonitor.disconnect(this.userStyleHandler);
this.userStyleHandler = null;
}
if (this.userStyleMonitor) {
this.userStyleMonitor.cancel();
this.userStyleMonitor = null;
}
if (this.monitorChangedHandler) {
Main.layoutManager.disconnect(this.monitorChangedHandler);
this.monitorChangedHandler = null;
}
if (this.indicatorSettingHandler) {
this.settings.disconnect(this.indicatorSettingHandler);
Me.settings.disconnect(this.indicatorSettingHandler);
this.indicatorSettingHandler = null;
}
if (this.desktopSettingHandler) {
this.settings.disconnect(this.desktopSettingHandler);
Me.settings.disconnect(this.desktopSettingHandler);
this.desktopSettingHandler = null;
}
if (this.persistentSettingHandler) {
this.settings.disconnect(this.persistentSettingHandler);
this.persistentSettingHandler = null;
if (this.persistentOverTogglesSettingHandler) {
Me.settings.disconnect(this.persistentOverTogglesSettingHandler);
this.persistentOverTogglesSettingHandler = null;
}
if (this.persistentOverRestartsSettingHandler) {
Me.settings.disconnect(this.persistentOverRestartsSettingHandler);
this.persistentOverRestartsSettingHandler = null;
}
if (this.activeArea)
this.toggleDrawing();
Main.wm.removeKeybinding('toggle-drawing');
Main.wm.removeKeybinding('toggle-modal');
Main.wm.removeKeybinding('erase-drawing');
Main.wm.removeKeybinding('erase-drawings');
this.removeAreas();
Files.Images.disable();
Files.Jsons.disable();
if (this.indicator)
this.indicator.disable();
}
@ -556,7 +562,7 @@ var AreaManager = new Lang.Class({
// The same as the original, without forcing a ratio of 1.
const OsdWindowConstraint = new Lang.Class({
Name: 'DrawOnYourScreenOsdWindowConstraint',
Name: `${UUID}-OsdWindowConstraint`,
Extends: OsdWindow.OsdWindowConstraint,
vfunc_update_allocation: function(actor, actorBox) {
@ -578,7 +584,7 @@ const OsdWindowConstraint = new Lang.Class({
});
const DrawingIndicator = new Lang.Class({
Name: 'DrawOnYourScreenIndicator',
Name: `${UUID}-Indicator`,
_init: function() {
let [menuAlignment, dontCreateMenu] = [0, true];
@ -601,12 +607,3 @@ const DrawingIndicator = new Lang.Class({
}
});
function setCursor(cursorName) {
// check display or screen (API changes)
if (global.display.set_cursor)
global.display.set_cursor(Meta.Cursor[cursorName]);
else if (global.screen && global.screen.set_cursor)
global.screen.set_cursor(Meta.Cursor[cursorName]);
}

549
files.js
View File

@ -1,14 +1,9 @@
/* jslint esversion: 6 */
/*
* Copyright 2019 Abakkk
*
* This file is part of DrawOnYourScreen, a drawing extension for GNOME Shell.
* https://framagit.org/abakkk/DrawOnYourScreen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ -18,23 +13,93 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-FileCopyrightText: 2019 Abakkk
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/* jslint esversion: 6 */
/* exported Icons, Image, Images, Json, Jsons, getDateString, saveSvg */
const ByteArray = imports.byteArray;
const Gdk = imports.gi.Gdk;
const GdkPixbuf = imports.gi.GdkPixbuf;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const St = imports.gi.St;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const EXAMPLE_IMAGES = Me.dir.get_child('data').get_child('images');
const USER_IMAGES = Gio.File.new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), Me.metadata['data-dir'], 'images']));
const UUID = Me.uuid.replace(/@/gi, '_at_').replace(/[^a-z0-9+_-]/gi, '_');
const EXAMPLE_IMAGE_DIRECTORY = Me.dir.get_child('data').get_child('images');
const DEFAULT_USER_IMAGE_LOCATION = GLib.build_filenamev([GLib.get_user_data_dir(), Me.metadata['data-dir'], 'images']);
const Clipboard = St.Clipboard.get_default();
const CLIPBOARD_TYPE = St.ClipboardType.CLIPBOARD;
const ICON_DIR = Me.dir.get_child('data').get_child('icons');
const ICON_NAMES = [
'arc', 'color', 'dashed-line', 'document-export', 'fillrule-evenodd', 'fillrule-nonzero', 'fill', 'full-line', 'linecap', 'linejoin', 'palette', 'smooth', 'stroke',
'tool-ellipse', 'tool-line', 'tool-mirror', 'tool-move', 'tool-none', 'tool-polygon', 'tool-polyline', 'tool-rectangle', 'tool-resize',
];
const ThemedIconName = {
COLOR_PICKER: 'color-select-symbolic',
ENTER: 'applications-graphics', LEAVE: 'application-exit',
GRAB: 'input-touchpad', UNGRAB: 'touchpad-disabled',
OPEN: 'document-open', SAVE: 'document-save',
FONT_FAMILY: 'font-x-generic', FONT_STYLE: 'format-text-italic', FONT_WEIGHT:'format-text-bold',
LEFT_ALIGNED: 'format-justify-left', CENTERED: 'format-justify-center',RIGHT_ALIGNED: 'format-justify-right',
TOOL_IMAGE: 'insert-image', TOOL_TEXT: 'insert-text',
};
// wrapper around an image file
var Icons = {
get FAKE() {
if (!this._fake) {
let bytes = new GLib.Bytes('<svg/>');
this._fake = Gio.BytesIcon.new(bytes);
}
return this._fake;
}
};
ICON_NAMES.forEach(name => {
Object.defineProperty(Icons, name.toUpperCase().replace(/-/gi, '_'), {
get: function() {
if (!this[`_${name}`]) {
let file = Gio.File.new_for_path(ICON_DIR.get_child(`${name}-symbolic.svg`).get_path());
this[`_${name}`] = file.query_exists(null) ? new Gio.FileIcon({ file }) : new Gio.ThemedIcon({ name: 'action-unavailable-symbolic' });
}
return this[`_${name}`];
}
});
});
Object.keys(ThemedIconName).forEach(key => {
Object.defineProperty(Icons, key, {
get: function() {
if (!this[`_${key}`])
this[`_${key}`] = new Gio.ThemedIcon({ name: `${ThemedIconName[key]}-symbolic` });
return this[`_${key}`];
}
});
});
const replaceColor = function (contents, color) {
if (contents instanceof Uint8Array)
contents = ByteArray.toString(contents);
else
contents = contents.toString();
return contents.replace(/fill(?=="transparent"|="none"|:transparent|:none)/gi, 'filll')
.replace(/fill="[^"]+"/gi, `fill="${color}"`)
.replace(/fill:[^";]+/gi, `fill:${color};`)
.replace(/filll/gi, 'fill');
};
// Wrapper around image data. If not subclassed, it is used when loading in the area an image element for a drawing file (.json)
// and it takes { displayName, contentType, base64, hash } as params.
var Image = new Lang.Class({
Name: 'DrawOnYourScreenImage',
Name: `${UUID}-Image`,
_init: function(params) {
for (let key in params)
@ -45,7 +110,7 @@ var Image = new Lang.Class({
return this.displayName;
},
toJson: function() {
toJSON: function() {
return {
displayName: this.displayName,
contentType: this.contentType,
@ -54,29 +119,9 @@ var Image = new Lang.Class({
};
},
// only called from menu so file exists
get gicon() {
if (!this._gicon)
this._gicon = new Gio.FileIcon({ file: this.file });
return this._gicon;
},
get bytes() {
if (!this._bytes) {
if (this.file)
try {
// load_bytes available in GLib 2.56+
this._bytes = this.file.load_bytes(null)[0];
} catch(e) {
let [success_, contents] = this.file.load_contents(null);
if (contents instanceof Uint8Array)
this._bytes = ByteArray.toGBytes(contents);
else
this._bytes = contents.toGBytes();
}
else
if (!this._bytes)
this._bytes = new GLib.Bytes(GLib.base64_decode(this.base64));
}
return this._bytes;
},
@ -90,6 +135,14 @@ var Image = new Lang.Class({
this._base64 = base64;
},
getBase64ForColor: function(color) {
if (!color || this.contentType != 'image/svg+xml')
return this.base64;
let contents = GLib.base64_decode(this.base64);
return GLib.base64_encode(replaceColor(contents, color));
},
// hash is not used
get hash() {
if (!this._hash)
@ -101,7 +154,22 @@ var Image = new Lang.Class({
this._hash = hash;
},
get pixbuf() {
getBytesForColor: function(color) {
if (!color || this.contentType != 'image/svg+xml')
return this.bytes;
let contents = this.bytes.get_data();
return new GLib.Bytes(replaceColor(contents, color));
},
getPixbuf: function(color) {
if (color) {
let stream = Gio.MemoryInputStream.new_from_bytes(this.getBytesForColor(color));
let pixbuf = GdkPixbuf.Pixbuf.new_from_stream(stream, null);
stream.close(null);
return pixbuf;
}
if (!this._pixbuf) {
let stream = Gio.MemoryInputStream.new_from_bytes(this.bytes);
this._pixbuf = GdkPixbuf.Pixbuf.new_from_stream(stream, null);
@ -110,56 +178,234 @@ var Image = new Lang.Class({
return this._pixbuf;
},
getPixbufAtScale: function(width, height) {
let stream = Gio.MemoryInputStream.new_from_bytes(this.bytes);
getPixbufAtScale: function(width, height, color) {
let stream = Gio.MemoryInputStream.new_from_bytes(this.getBytesForColor(color));
let pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale(stream, width, height, true, null);
stream.close(null);
return pixbuf;
},
setCairoSource: function(cr, x, y, width, height, preserveAspectRatio) {
let pixbuf = preserveAspectRatio ? this.getPixbufAtScale(width, height)
: this.pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.BILINEAR);
setCairoSource: function(cr, x, y, width, height, preserveAspectRatio, color) {
let pixbuf = preserveAspectRatio ? this.getPixbufAtScale(width, height, color)
: this.getPixbuf(color).scale_simple(width, height, GdkPixbuf.InterpType.BILINEAR);
Gdk.cairo_set_source_pixbuf(cr, pixbuf, x, y);
}
});
var getImages = function() {
let images = [];
// Add a gicon generator to Image. It is used with image files and it takes { file, info } as params.
const ImageWithGicon = new Lang.Class({
Name: `${UUID}-ImageWithGicon`,
Extends: Image,
[EXAMPLE_IMAGES, USER_IMAGES].forEach(directory => {
let enumerator;
get displayName() {
return this.info.get_display_name();
},
get contentType() {
return this.info.get_content_type();
},
get thumbnailFile() {
if (!this._thumbnailFile) {
if (this.info.has_attribute('thumbnail::path') && this.info.get_attribute_boolean('thumbnail::is-valid')) {
let thumbnailPath = this.info.get_attribute_as_string('thumbnail::path');
this._thumbnailFile = Gio.File.new_for_path(thumbnailPath);
}
}
return this._thumbnailFile || null;
},
get gicon() {
if (!this._gicon)
this._gicon = new Gio.FileIcon({ file: this.thumbnailFile || this.file });
return this._gicon;
},
// use only thumbnails in menu (memory)
get thumbnailGicon() {
if (this.contentType != 'image/svg+xml' && !this.thumbnailFile)
return null;
return this.gicon;
},
get bytes() {
if (!this._bytes) {
try {
enumerator = directory.enumerate_children('standard::display-name,standard::content-type', Gio.FileQueryInfoFlags.NONE, null);
// load_bytes available in GLib 2.56+
this._bytes = this.file.load_bytes(null)[0];
} catch(e) {
let [, contents] = this.file.load_contents(null);
if (contents instanceof Uint8Array)
this._bytes = ByteArray.toGBytes(contents);
else
this._bytes = contents.toGBytes();
}
}
return this._bytes;
}
});
// It is directly generated from a Json object, without an image file. It takes { bytes, displayName, gicon } as params.
const ImageFromJson = new Lang.Class({
Name: `${UUID}-ImageFromJson`,
Extends: Image,
contentType: 'image/svg+xml',
get bytes() {
return this._bytes;
},
set bytes(bytes) {
this._bytes = bytes;
}
});
// Access images with getPrevious, getNext, getSorted or by iterating over it.
var Images = {
_images: [],
_clipboardImages: [],
_upToDate: false,
disable: function() {
this._images = [];
this._clipboardImages = [];
this._upToDate = false;
},
_clipboardImagesContains: function(file) {
return this._clipboardImages.some(image => image.file.equal(file));
},
// Firstly iterate over the extension directory that contains Example.svg,
// secondly iterate over the directory that was configured by the user in prefs,
// finally iterate over the images pasted from the clipboard.
[Symbol.iterator]: function() {
if (this._upToDate)
return this._images.concat(this._clipboardImages)[Symbol.iterator]();
this._upToDate = true;
let oldImages = this._images;
let newImages = this._images = [];
let clipboardImagesContains = this._clipboardImagesContains.bind(this);
let clipboardIterator = this._clipboardImages[Symbol.iterator]();
return {
getExampleEnumerator: function() {
try {
return EXAMPLE_IMAGE_DIRECTORY.enumerate_children('standard::,thumbnail::', Gio.FileQueryInfoFlags.NONE, null);
} catch(e) {
return this.getUserEnumerator();
}
},
getUserEnumerator: function() {
try {
let userLocation = Me.drawingSettings.get_string('image-location') || DEFAULT_USER_IMAGE_LOCATION;
let userDirectory = Gio.File.new_for_commandline_arg(userLocation);
return userDirectory.enumerate_children('standard::,thumbnail::', Gio.FileQueryInfoFlags.NONE, null);
} catch(e) {
return null;
}
},
get enumerator() {
if (this._enumerator === undefined)
this._enumerator = this.getExampleEnumerator();
else if (this._enumerator && this._enumerator.get_container().equal(EXAMPLE_IMAGE_DIRECTORY) && this._enumerator.is_closed())
this._enumerator = this.getUserEnumerator();
else if (this._enumerator && this._enumerator.is_closed())
this._enumerator = null;
return this._enumerator;
},
next: function() {
if (!this.enumerator)
return clipboardIterator.next();
let info = this.enumerator.next_file(null);
if (!info) {
this.enumerator.close(null);
return this.next();
}
let file = this.enumerator.get_child(info);
if (info.get_content_type().indexOf('image') == 0 && !clipboardImagesContains(file)) {
let image = oldImages.find(oldImage => oldImage.file.equal(file)) || new ImageWithGicon({ file, info });
newImages.push(image);
return { value: image, done: false };
} else {
return this.next();
}
}
};
},
getSorted: function() {
return [...this].sort((a, b) => a.toString().localeCompare(b.toString()));
},
getNext: function(currentImage) {
let images = this.getSorted();
let index = currentImage && currentImage.file ? images.findIndex(image => image.file.equal(currentImage.file)) : -1;
return images[index == images.length - 1 ? 0 : index + 1] || null;
},
getPrevious: function(currentImage) {
let images = this.getSorted();
let index = currentImage && currentImage.file ? images.findIndex(image => image.file.equal(currentImage.file)) : -1;
return images[index <= 0 ? images.length - 1 : index - 1] || null;
},
reset: function() {
this._upToDate = false;
},
addImagesFromClipboard: function(callback) {
Clipboard.get_text(CLIPBOARD_TYPE, (clipboard, text) => {
if (!text)
return;
// Since 3.38 there is a line terminator character, that has to be removed with .trim().
let lines = text.split('\n').map(line => line.trim());
if (lines[0] == 'x-special/nautilus-clipboard')
lines = lines.slice(2);
let images = lines.filter(line => !!line)
.map(line => Gio.File.new_for_commandline_arg(line))
.filter(file => file.query_exists(null))
.map(file => [file, file.query_info('standard::,thumbnail::', Gio.FileQueryInfoFlags.NONE, null)])
.filter(pair => pair[1].get_content_type().indexOf('image') == 0)
.map(pair => new ImageWithGicon({ file: pair[0], info: pair[1] }));
// Prevent duplicated
images.filter(image => !this._clipboardImagesContains(image.file))
.forEach(image => this._clipboardImages.push(image));
if (images.length) {
this.reset();
let lastFile = images[images.length - 1].file;
callback(this._clipboardImages.find(image => image.file.equal(lastFile)));
}
let fileInfo = enumerator.next_file(null);
while (fileInfo) {
if (fileInfo.get_content_type().indexOf('image') == 0)
images.push(new Image({ file: enumerator.get_child(fileInfo), contentType: fileInfo.get_content_type(), displayName: fileInfo.get_display_name() }));
fileInfo = enumerator.next_file(null);
});
}
enumerator.close(null);
});
images.sort((a, b) => {
return a.displayName.localeCompare(b.displayName);
});
return images;
};
// wrapper around a json file
// Wrapper around a json file (drawing saves).
var Json = new Lang.Class({
Name: 'DrawOnYourScreenJson',
Name: `${UUID}-Json`,
_init: function(params) {
for (let key in params)
this[key] = params[key];
},
get isPersistent() {
return this.name == Me.metadata['persistent-file-name'];
},
toString: function() {
return this.displayName || this.name;
},
@ -169,10 +415,10 @@ var Json = new Lang.Class({
},
get file() {
if (!this._file && this.name)
if (!this._file)
this._file = Gio.File.new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), Me.metadata['data-dir'], `${this.name}.json`]));
return this._file || null;
return this._file;
},
set file(file) {
@ -180,62 +426,183 @@ var Json = new Lang.Class({
},
get contents() {
let success_, contents;
if (this._contents === undefined) {
try {
[success_, contents] = this.file.load_contents(null);
if (contents instanceof Uint8Array)
contents = ByteArray.toString(contents);
[, this._contents] = this.file.load_contents(null);
if (this._contents instanceof Uint8Array)
this._contents = ByteArray.toString(this._contents);
} catch(e) {
return null;
this._contents = null;
}
return contents;
}
return this._contents;
},
set contents(contents) {
if (this.isPersistent && (this.contents == contents || !this.contents && contents == '[]'))
return;
try {
this.file.replace_contents(contents, null, false, Gio.FileCreateFlags.NONE, null);
} catch(e) {
this.file.get_parent().make_directory_with_parents(null);
this.file.replace_contents(contents, null, false, Gio.FileCreateFlags.NONE, null);
}
this._contents = contents;
},
addSvgContents: function(getGiconSvgContent, getImageSvgContent) {
let giconSvgBytes = new GLib.Bytes(getGiconSvgContent());
this.gicon = Gio.BytesIcon.new(giconSvgBytes);
this.getImageSvgBytes = () => new GLib.Bytes(getImageSvgContent());
},
get image() {
if (!this._image)
this._image = new ImageFromJson({ bytes: this.getImageSvgBytes(), gicon: this.gicon, displayName: this.displayName });
return this._image;
}
});
var getJsons = function() {
// Access jsons with getPersistent, getDated, getNamed, getPrevious, getNext, getSorted or by iterating over it.
var Jsons = {
_jsons: [],
_upToDate: false,
disable: function() {
if (this._monitor) {
this._monitor.disconnect(this._monitorHandler);
this._monitor.cancel();
}
delete this._monitor;
delete this._persistent;
this._jsons = [];
this._upToDate = false;
},
_updateMonitor: function() {
if (this._monitor)
return;
let directory = Gio.File.new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), Me.metadata['data-dir']]));
// It is important to specify that the file to monitor is a directory because maybe the directory does not exist yet
// and remove events would not be monitored.
this._monitor = directory.monitor_directory(Gio.FileMonitorFlags.NONE, null);
this._monitorHandler = this._monitor.connect('changed', (monitor, file) => {
if (file.get_basename() != `${Me.metadata['persistent-file-name']}.json` && file.get_basename().indexOf('.goutputstream'))
this.reset();
});
},
let enumerator;
[Symbol.iterator]: function() {
if (this._upToDate)
return this._jsons[Symbol.iterator]();
this._updateMonitor();
this._upToDate = true;
let newJsons = this._jsons = [];
return {
get enumerator() {
if (this._enumerator === undefined) {
try {
enumerator = directory.enumerate_children('standard::name,standard::display-name,standard::content-type,time::modified', Gio.FileQueryInfoFlags.NONE, null);
let directory = Gio.File.new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), Me.metadata['data-dir']]));
this._enumerator = directory.enumerate_children('standard::name,standard::display-name,standard::content-type,time::modified', Gio.FileQueryInfoFlags.NONE, null);
} catch(e) {
return [];
this._enumerator = null;
}
}
let jsons = [];
let fileInfo = enumerator.next_file(null);
while (fileInfo) {
if (fileInfo.get_content_type().indexOf('json') != -1 && fileInfo.get_name() != `${Me.metadata['persistent-file-name']}.json`) {
let file = enumerator.get_child(fileInfo);
jsons.push(new Json({
file,
name: fileInfo.get_name().slice(0, -5),
displayName: fileInfo.get_display_name().slice(0, -5),
// fileInfo.get_modification_date_time: Gio 2.62+
modificationUnixTime: fileInfo.get_attribute_uint64('time::modified')
}));
}
fileInfo = enumerator.next_file(null);
}
enumerator.close(null);
return this._enumerator;
},
jsons.sort((a, b) => {
return b.modificationUnixTime - a.modificationUnixTime;
next: function() {
if (!this.enumerator || this.enumerator.is_closed())
return { done: true };
let info = this.enumerator.next_file(null);
if (!info) {
this.enumerator.close(null);
return this.next();
}
let file = this.enumerator.get_child(info);
if (info.get_content_type().indexOf('json') != -1 && info.get_name() != `${Me.metadata['persistent-file-name']}.json`) {
let json = new Json({
file, name: info.get_name().slice(0, -5),
displayName: info.get_display_name().slice(0, -5),
// info.get_modification_date_time: Gio 2.62+
modificationUnixTime: info.get_attribute_uint64('time::modified')
});
return jsons;
newJsons.push(json);
return { value: json, done: false };
} else {
return this.next();
}
}
};
},
getSorted: function() {
return [...this].sort((a, b) => b.modificationUnixTime - a.modificationUnixTime);
},
getNext: function(currentJson) {
let jsons = this.getSorted();
let index = currentJson ? jsons.findIndex(json => json.name == currentJson.name) : -1;
return jsons[index == jsons.length - 1 ? 0 : index + 1] || null;
},
getPrevious: function(currentJson) {
let jsons = this.getSorted();
let index = currentJson ? jsons.findIndex(json => json.name == currentJson.name) : -1;
return jsons[index <= 0 ? jsons.length - 1 : index - 1] || null;
},
getPersistent: function() {
if (!this._persistent)
this._persistent = new Json({ name: Me.metadata['persistent-file-name'] });
return this._persistent;
},
getDated: function() {
return new Json({ name: getDateString() });
},
getNamed: function(name) {
return [...this].find(json => json.name == name) || new Json({ name });
},
reset: function() {
this._upToDate = false;
}
};
var getDateString = function() {
let date = GLib.DateTime.new_now_local();
return `${date.format("%F")} ${date.format("%X")}`;
return `${date.format("%F")} ${date.format("%T")}`;
};
var saveSvg = function(content) {
let filename = `${Me.metadata['svg-file-name']} ${getDateString()}.svg`;
let dir = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES);
let path = GLib.build_filenamev([dir, filename]);
let file = Gio.File.new_for_path(path);
if (file.query_exists(null))
return false;
try {
return file.replace_contents(content, null, false, Gio.FileCreateFlags.NONE, null)[0];
} catch(e) {
return false;
}
};

95
gimpPaletteParser.js Normal file
View File

@ -0,0 +1,95 @@
/*
* Copyright 2019 Abakkk
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-FileCopyrightText: 2019 Abakkk
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/* jslint esversion: 6 */
/* exported parseFile */
const ByteArray = imports.byteArray;
/*
* [
* [
* 'palette name 1', // a palette for each column
* [
* 'rgb(...)',
* 'rgb(...):color display name', // the optional name separated with ':'
* ...
* ]
* ],
* [
* 'palette name 2',
* [...]
* ],
* ...
* ]
*/
function parse(contents) {
let lines = contents.split('\n');
let line, name, columnNumber;
line = lines.shift();
if (!line || !line.startsWith('GIMP Palette'))
log("Missing magic header");
line = lines.shift();
if (line.startsWith('Name:')) {
name = line.slice(5).trim() || file.get_basename();
line = lines.shift();
}
if (line.startsWith('Columns:')) {
columnNumber = Number(line.slice(8).trim()) || 1;
line = lines.shift();
}
let columns = (new Array(columnNumber)).fill(null).map(() => []);
lines.forEach((line, index) => {
if (!line || line.startsWith('#'))
return;
line = line.split('#')[0].trim();
let [, color, displayName] = line.split(/(^[\d\s]+)/);
let values = color.trim().split(/\D+/gi).filter(value => value >= 0 && value <= 255);
if (values.length < 3)
return;
let string = `rgb(${values[0]},${values[1]},${values[2]})`;
if (displayName.trim())
string += `:${displayName.trim()}`;
columns[index % columns.length].push(string);
});
return columns.map((column, index) => [columnNumber > 1 ? `${name} ${index + 1}` : name, column]);
}
function parseFile(file) {
if (!file.query_exists(null))
return [];
let [, contents] = file.load_contents(null);
if (contents instanceof Uint8Array)
contents = ByteArray.toString(contents);
return parse(contents);
}

141
helper.js
View File

@ -1,14 +1,9 @@
/* jslint esversion: 6 */
/*
* Copyright 2019 Abakkk
*
* This file is part of DrawOnYourScreen, a drawing extension for GNOME Shell.
* https://framagit.org/abakkk/DrawOnYourScreen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ -18,36 +13,39 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-FileCopyrightText: 2019 Abakkk
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/* jslint esversion: 6 */
/* exported DrawingHelper */
const Clutter = imports.gi.Clutter;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const St = imports.gi.St;
const Config = imports.misc.config;
const Tweener = imports.ui.tweener;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = ExtensionUtils.getSettings ? ExtensionUtils : Me.imports.convenience;
const Prefs = Me.imports.prefs;
const Shortcuts = Me.imports.shortcuts;
const _ = imports.gettext.domain(Me.metadata['gettext-domain']).gettext;
const GS_VERSION = Config.PACKAGE_VERSION;
const Tweener = GS_VERSION < '3.33.0' ? imports.ui.tweener : null;
const HELPER_ANIMATION_TIME = 0.25;
const MEDIA_KEYS_SCHEMA = 'org.gnome.settings-daemon.plugins.media-keys';
const MEDIA_KEYS_KEYS = {
'screenshot': "Screenshot",
'screenshot-clip': "Screenshot to clipboard",
'area-screenshot': "Area screenshot",
'area-screenshot-clip': "Area screenshot to clipboard"
};
const MEDIA_KEYS_KEYS = ['screenshot', 'screenshot-clip', 'area-screenshot', 'area-screenshot-clip'];
const UUID = Me.uuid.replace(/@/gi, '_at_').replace(/[^a-z0-9+_-]/gi, '_');
// DrawingHelper provides the "help osd" (Ctrl + F1)
// It uses the same texts as in prefs
var DrawingHelper = new Lang.Class({
Name: 'DrawOnYourScreenDrawingHelper',
Name: `${UUID}-DrawingHelper`,
Extends: St.ScrollView,
_init: function(params, monitor) {
@ -55,25 +53,33 @@ var DrawingHelper = new Lang.Class({
this.parent(params);
this.monitor = monitor;
this.hide();
this.settings = Convenience.getSettings();
this.settingHandler = this.settings.connect('changed', this._onSettingChanged.bind(this));
this.connect('destroy', () => this.settings.disconnect(this.settingHandler));
this.settingsHandler = Me.settings.connect('changed', this._onSettingsChanged.bind(this));
this.internalShortcutsettingsHandler = Me.internalShortcutSettings.connect('changed', this._onSettingsChanged.bind(this));
this.connect('destroy', () => {
Me.settings.disconnect(this.settingsHandler);
Me.internalShortcutSettings.disconnect(this.internalShortcutsettingsHandler);
});
},
_onSettingChanged: function(settings, key) {
_onSettingsChanged: function(settings, key) {
if (key == 'toggle-help')
this._updateHelpKeyLabel();
if (this.vbox) {
this.vbox.destroy();
this.vbox = null;
delete this.vbox;
}
},
_updateHelpKeyLabel: function() {
let [keyval, mods] = Gtk.accelerator_parse(this.settings.get_strv('toggle-help')[0]);
try {
let [keyval, mods] = Gtk.accelerator_parse(Me.internalShortcutSettings.get_strv('toggle-help')[0] || '');
this._helpKeyLabel = Gtk.accelerator_get_label(keyval, mods);
} catch(e) {
logError(e);
this._helpKeyLabel = " ";
}
},
get helpKeyLabel() {
@ -88,63 +94,72 @@ var DrawingHelper = new Lang.Class({
this.add_actor(this.vbox);
this.vbox.add_child(new St.Label({ text: _("Global") }));
for (let settingKey in Prefs.GLOBAL_KEYBINDINGS) {
Shortcuts.GLOBAL_KEYBINDINGS.forEach((settingKeys, index) => {
if (index)
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
settingKeys.forEach(settingKey => {
if (!Me.settings.get_strv(settingKey)[0])
return;
let hbox = new St.BoxLayout({ vertical: false });
if (settingKey.indexOf('-separator-') != -1) {
this.vbox.add_child(hbox);
continue;
}
if (!this.settings.get_strv(settingKey)[0])
continue;
let [keyval, mods] = Gtk.accelerator_parse(this.settings.get_strv(settingKey)[0]);
hbox.add_child(new St.Label({ text: _(Prefs.GLOBAL_KEYBINDINGS[settingKey]) }));
let [keyval, mods] = Gtk.accelerator_parse(Me.settings.get_strv(settingKey)[0] || '');
hbox.add_child(new St.Label({ text: Me.settings.settings_schema.get_key(settingKey).get_summary() }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
});
});
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
this.vbox.add_child(new St.Label({ text: _("Internal") }));
for (let i = 0; i < Prefs.OTHER_SHORTCUTS.length; i++) {
if (Prefs.OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) {
Shortcuts.OTHERS.forEach((pairs, index) => {
if (index)
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
continue;
}
pairs.forEach(pair => {
let [action, shortcut] = pair;
let hbox = new St.BoxLayout({ vertical: false });
hbox.add_child(new St.Label({ text: _(Prefs.OTHER_SHORTCUTS[i].desc) }));
hbox.add_child(new St.Label({ text: Prefs.OTHER_SHORTCUTS[i].shortcut, x_expand: true }));
hbox.add_child(new St.Label({ text: action }));
hbox.add_child(new St.Label({ text: shortcut, x_expand: true }));
hbox.get_children()[0].get_clutter_text().set_use_markup(true);
this.vbox.add_child(hbox);
}
});
});
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
for (let settingKey in Prefs.INTERNAL_KEYBINDINGS) {
if (settingKey.indexOf('-separator-') != -1) {
Shortcuts.INTERNAL_KEYBINDINGS.forEach((settingKeys, index) => {
if (index)
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
continue;
}
settingKeys.forEach(settingKey => {
if (!Me.internalShortcutSettings.get_strv(settingKey)[0])
return;
let hbox = new St.BoxLayout({ vertical: false });
if (!this.settings.get_strv(settingKey)[0])
continue;
let [keyval, mods] = Gtk.accelerator_parse(this.settings.get_strv(settingKey)[0]);
hbox.add_child(new St.Label({ text: _(Prefs.INTERNAL_KEYBINDINGS[settingKey]) }));
let [keyval, mods] = Gtk.accelerator_parse(Me.internalShortcutSettings.get_strv(settingKey)[0] || '');
hbox.add_child(new St.Label({ text: Me.internalShortcutSettings.settings_schema.get_key(settingKey).get_summary() }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
});
});
let mediaKeysSettings;
try { mediaKeysSettings = Convenience.getSettings(MEDIA_KEYS_SCHEMA); } catch(e) { return; }
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
this.vbox.add_child(new St.Label({ text: _("System") }));
for (let settingKey in MEDIA_KEYS_KEYS) {
for (let settingKey of MEDIA_KEYS_KEYS) {
if (!mediaKeysSettings.settings_schema.has_key(settingKey))
continue;
let shortcut = GS_VERSION < '3.33.0' ? mediaKeysSettings.get_string(settingKey) : mediaKeysSettings.get_strv(settingKey)[0];
if (!shortcut)
continue;
let [keyval, mods] = Gtk.accelerator_parse(shortcut);
let [keyval, mods] = Gtk.accelerator_parse(shortcut || '');
let hbox = new St.BoxLayout({ vertical: false });
hbox.add_child(new St.Label({ text: _(MEDIA_KEYS_KEYS[settingKey]) }));
hbox.add_child(new St.Label({ text: mediaKeysSettings.settings_schema.get_key(settingKey).get_summary() }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
@ -162,25 +177,39 @@ var DrawingHelper = new Lang.Class({
this.set_position(Math.floor(this.monitor.width / 2 - this.width / 2),
Math.floor(this.monitor.height / 2 - this.height / 2));
// St.PolicyType: GS 3.32+
if (this.height == maxHeight)
this.vscrollbar_policy = Gtk.PolicyType.ALWAYS;
this.vscrollbar_policy = St.PolicyType ? St.PolicyType.ALWAYS : Gtk.PolicyType.ALWAYS;
else
this.vscrollbar_policy = Gtk.PolicyType.NEVER;
this.vscrollbar_policy = St.PolicyType ? St.PolicyType.NEVER : Gtk.PolicyType.NEVER;
if (Tweener) {
Tweener.removeTweens(this);
Tweener.addTween(this, { opacity: 255,
time: HELPER_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: null });
transition: 'easeOutQuad' });
} else {
this.remove_all_transitions();
this.ease({ opacity: 255,
duration: HELPER_ANIMATION_TIME * 1000,
transition: Clutter.AnimationMode.EASE_OUT_QUAD });
}
},
hideHelp: function() {
if (Tweener) {
Tweener.removeTweens(this);
Tweener.addTween(this, { opacity: 0,
time: HELPER_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this.hide.bind(this) });
} else {
this.remove_all_transitions();
this.ease({ opacity: 0,
duration: HELPER_ANIMATION_TIME * 1000,
transition: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: this.hide.bind(this) });
}
}
});

8
locale/POTFILES.in Normal file
View File

@ -0,0 +1,8 @@
# xgettext --from-code=UTF-8 --add-comments="Translators: " --no-location --package-name="Draw On Your Screen" --msgid-bugs-address="https://codeberg.org/som/DrawOnYourScreen/issues" -f locale/POTFILES.in
area.js
extension.js
helper.js
menu.js
prefs.js
shortcuts.js
schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml

Binary file not shown.

View File

@ -0,0 +1,741 @@
# <language> translations for Draw On Your Screen.
# Copyright (C) 2019 Listed translators
#
# This file is distributed under the same license as Draw On Your Screen.
# Onno Giesmann <nutzer3105@gmail.com>, 2020-2021.
#
# Some words refer to SVG attributes (font, line, fill rule ...).
# You are free to translate them or not.
msgid ""
msgstr ""
"Project-Id-Version: Draw On Your Screen\n"
"Report-Msgid-Bugs-To: https://codeberg.org/som/DrawOnYourScreen/issues\n"
"POT-Creation-Date: 2021-02-17 14:14+0100\n"
"PO-Revision-Date: 2021-03-04 08:21+0100\n"
"Last-Translator: Onno Giesmann <nutzer3105@gmail.com>\n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. Translators: %s is a key label
#, javascript-format
msgid ""
"Press <i>%s</i> to get\n"
"a fourth control point"
msgstr ""
"<i>%s</i> drücken, um einen\n"
"vierten Kontrollpunkt zu erhalten"
msgid "Mark a point of symmetry"
msgstr "Symmetriepunkt markieren"
msgid "Draw a line of symmetry"
msgstr "Symmetrielinie zeichnen"
#. Translators: initial content of the text area
msgctxt "text-area-content"
msgid "Text"
msgstr "Text"
#. Translators: %s is a key label
#, javascript-format
msgid "Press <i>%s</i> to mark vertices"
msgstr ""
"<i>%s</i> drücken, um\n"
"Scheitelpunkte zu markieren"
#. Translators: %s is a key label
#, javascript-format
msgid ""
"Press <i>%s</i>\n"
"to start a new line"
msgstr ""
"<i>%s</i> drücken, um\n"
"neue Zeile zu beginnen"
#. Translators: It is displayed in an OSD notification to ask the user to start picking, so it should use the imperative mood.
msgctxt "osd-notification"
msgid "Pick a color"
msgstr "Wählen Sie eine Farbe"
#. Translators: "released" as the opposite of "grabbed"
msgid "Keyboard and pointer released"
msgstr "Tastatur und Zeiger losgelöst"
msgid "Keyboard and pointer grabbed"
msgstr "Tastatur und Zeiger gekoppelt"
msgid "Leaving drawing mode"
msgstr "Verlasse Zeichnungsmodus"
#. Translators: %s is a key label
#, javascript-format
msgid "Press <i>%s</i> for help"
msgstr "Für Hilfe <i>%s</i> drücken"
msgid "Entering drawing mode"
msgstr "Beginne Zeichnungsmodus"
msgid "Global"
msgstr "Global"
msgid "Internal"
msgstr "Intern"
msgid "System"
msgstr "System"
msgid "Dashed line"
msgstr "Gestrichelte Linie"
#. Translators: as the alternative to "Dashed line"
msgid "Full line"
msgstr "Volle Linie"
msgid "Fill"
msgstr "Füllen"
#. Translators: as the alternative to "Fill"
msgid "Outline"
msgstr "Außenlinie"
#. Translators: fill-rule SVG attribute
msgid "Nonzero"
msgstr "Nonzero"
msgid "Evenodd"
msgstr "Evenodd"
#. Translators: generic font-family SVG attribute
msgctxt "font-family"
msgid "Sans-Serif"
msgstr "Sans-Serif"
msgctxt "font-family"
msgid "Serif"
msgstr "Serif"
msgctxt "font-family"
msgid "Monospace"
msgstr "Monospace"
msgctxt "font-family"
msgid "Cursive"
msgstr "Cursive"
msgctxt "font-family"
msgid "Fantasy"
msgstr "Fantasy"
#. Translators: font-style SVG attribute
msgctxt "font-style"
msgid "Normal"
msgstr "Normal"
msgctxt "font-style"
msgid "Oblique"
msgstr "Schräg"
msgctxt "font-style"
msgid "Italic"
msgstr "Kursiv"
#. Translators: font-weight SVG attribute
msgctxt "font-weight"
msgid "Thin"
msgstr "Fein"
msgctxt "font-weight"
msgid "Ultra Light"
msgstr "Ultraleicht"
msgctxt "font-weight"
msgid "Light"
msgstr "Leicht"
msgctxt "font-weight"
msgid "Semi Light"
msgstr "Halbleicht"
msgctxt "font-weight"
msgid "Book"
msgstr "Buch"
msgctxt "font-weight"
msgid "Normal"
msgstr "Normal"
msgctxt "font-weight"
msgid "Medium"
msgstr "Medium"
msgctxt "font-weight"
msgid "Semi Bold"
msgstr "Halbfett"
msgctxt "font-weight"
msgid "Bold"
msgstr "Fett"
msgctxt "font-weight"
msgid "Ultra Bold"
msgstr "Ultrafett"
msgctxt "font-weight"
msgid "Heavy"
msgstr "Kräftig"
msgctxt "font-weight"
msgid "Ultra Heavy"
msgstr "Ultrakräftig"
#. Translators: stroke-linecap SVG attribute
msgctxt "stroke-linecap"
msgid "Butt"
msgstr "Rechtwinkeliges Ende"
msgctxt "stroke-linecap"
msgid "Round"
msgstr "Ende mit Halbkreis"
msgctxt "stroke-linecap"
msgid "Square"
msgstr "Ende mit Rechteck"
#. Translators: stroke-linejoin SVG attribute
msgctxt "stroke-linejoin"
msgid "Miter"
msgstr "Ecken mit Gehrung"
msgctxt "stroke-linejoin"
msgid "Round"
msgstr "Abgerundete Ecken"
msgctxt "stroke-linejoin"
msgid "Bevel"
msgstr "Abgeschrägte Ecken"
#. Translators: value in pixel unit (e.g. "5 px")
#, javascript-format
msgid "%f px"
msgstr "%f px"
msgid "Left aligned"
msgstr "Linksbündig"
msgid "Centered"
msgstr "Zentriert"
msgid "Right aligned"
msgstr "Rechtsbündig"
msgctxt "drawing-tool"
msgid "Free drawing"
msgstr "Freies Zeichnen"
msgctxt "drawing-tool"
msgid "Line"
msgstr "Linie"
msgctxt "drawing-tool"
msgid "Ellipse"
msgstr "Ellipse"
msgctxt "drawing-tool"
msgid "Rectangle"
msgstr "Rechteck"
msgctxt "drawing-tool"
msgid "Text"
msgstr "Text"
msgctxt "drawing-tool"
msgid "Polygon"
msgstr "Vieleck"
msgctxt "drawing-tool"
msgid "Polyline"
msgstr "Linienzug"
msgctxt "drawing-tool"
msgid "Image"
msgstr "Bild"
msgctxt "drawing-tool"
msgid "Move"
msgstr "Verschieben"
msgctxt "drawing-tool"
msgid "Resize"
msgstr "Größenänderung"
msgctxt "drawing-tool"
msgid "Mirror"
msgstr "Spiegeln"
msgid "Erase"
msgstr "Entfernen"
msgid "Smooth"
msgstr "Glätten"
msgid "Open drawing"
msgstr "Zeichnung öffnen"
msgid "Save drawing as…"
msgstr "Zeichnung speichern als…"
msgid "Palette"
msgstr "Farbpalette"
msgid "Color"
msgstr "Farbe"
#. Translators: It is displayed in a menu button tooltip or as a shortcut action description, so it should NOT use the imperative mood.
msgid "Pick a color"
msgstr "Auswählen einer Farbe"
msgid "Add to images"
msgstr "Zu Bildern hinzufügen"
msgid "Delete"
msgstr "Löschen"
msgid "Type a name"
msgstr "Namen eingeben"
#. Translators: "Preferences" page in preferences
msgid "Preferences"
msgstr "Einstellungen"
#. Translators: "Drawing" page in preferences
msgid "Drawing"
msgstr "Zeichnung"
#. Translators: "About" page in preferences
msgid "About"
msgstr "Info"
#. Translators: you are free to translate the extension name, that is displayed in About page, or not
msgid "Draw On You Screen"
msgstr "Zeichnungen auf Ihrem Bildschirm"
#. Translators: version number in "About" page
#, javascript-format
msgid "Version %f"
msgstr "Version %f"
#. Translators: you are free to translate the extension description, that is displayed in About page, or not
msgid ""
"Start drawing with Super+Alt+D and save your beautiful work by taking a "
"screenshot"
msgstr ""
"Beginnen Sie mit dem Zeichnen durch Drücken von Super+Alt+D.\n"
"Sie können Ihr Werk danach auch in einem Bildschirmfoto festhalten"
#. Translators: add your name here or keep it empty, it will be displayed in about page, e.g.
#. msgstr ""
#. "translator1\n"
#. "<a href=\"mailto:translator2@mail.org\">translator2</a>\n"
#. "<a href=\"https://...\">translator3</a>"
msgid "translator-credits"
msgstr "Onno Giesmann, Oktober 2020"
msgid "Palettes"
msgstr "Farbpaletten"
msgid "Add a new palette"
msgstr "Neue Farbpalette hinzufügen"
msgid "Area"
msgstr "Bereich"
msgid "Auto"
msgstr "Auto"
msgid "Grid overlay line"
msgstr "Gitterlinien anzeigen"
msgid "Tools"
msgstr "Werkzeuge"
msgid "Dash array"
msgstr "Strichdichte"
msgid "Reset settings"
msgstr "Einstellungen zurücksetzen"
msgid "Rename the palette"
msgstr "Farbpalette umbenennen"
msgid "Remove the palette"
msgstr "Farbpalette entfernen"
#. Translators: default name of a new palette
msgid "New palette"
msgstr "Neue Farbpalette"
msgid "In drawing mode"
msgstr "Im Zeichnungsmodus"
msgid "Draw"
msgstr "Zeichnen"
msgid "Left click"
msgstr "Linksklick"
msgid "Menu"
msgstr "Menü"
msgid "Right click"
msgstr "Rechtsklick"
msgid "Center click"
msgstr "Mittelklick"
msgid "Increment/decrement line width"
msgstr "Breitere/schwächere Linienstärke"
msgid "Scroll"
msgstr "Scrollen"
#. Translators: %s are key labels (Ctrl+F1 and Ctrl+F9)
msgid "Select color"
msgstr "Farbe wählen"
#, javascript-format
msgid "%s … %s"
msgstr "%s … %s"
#. Translators: %s is a key label
msgid "Ignore pointer movement"
msgstr "Zeigerbewegung ignorieren"
#, javascript-format
msgid "%s held"
msgstr "%s festhalten"
msgid "Leave"
msgstr "Beenden"
msgid "Select eraser <span alpha=\"50%\">(while starting drawing)</span>"
msgstr ""
"Radierer auswählen <span alpha=\"50%\">(während dem Beginnen mit Zeichnen)</"
"span>"
msgid "Duplicate <span alpha=\"50%\">(while starting handling)</span>"
msgstr "Duplizieren <span alpha=\"50%\">(beim Starten der Handhabung)</span>"
msgid "Rotate rectangle, polygon, polyline"
msgstr "Drehen von Rechteck, Vieleck, Linienzug"
msgid "Extend circle to ellipse"
msgstr "Kreis zur Ellipse erweitern"
msgid "Curve line"
msgstr "Kurvenlinie"
msgid "Smooth free drawing outline"
msgstr "Glatte freie Zeichnungskontur"
msgid "Do not preserve image ratio"
msgstr "Bildverhältnis nicht beibehalten"
msgid "Rotate <span alpha=\"50%\">(while moving)</span>"
msgstr "Drehen <span alpha=\"50%\">(während der Bewegung)</span>"
msgid "Stretch <span alpha=\"50%\">(while resizing)</span>"
msgstr "Dehnen <span alpha=\"50%\">(während der Veränderung)</span>"
msgid "Inverse <span alpha=\"50%\">(while mirroring)</span>"
msgstr "Umkehren <span alpha=\"50%\">(während dem Spiegeln)</span>"
msgid "Drawing on the desktop"
msgstr "Zeichnen auf dem Schreibtisch"
msgid "<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>"
msgstr ""
"<i>Zeichnungen auf Ihrem Bildschirm</i> wird zu <i>Zeichnungen auf Ihrem "
"Schreibtisch</i>"
msgid "Erase all drawings"
msgstr "Alle Zeichnungen löschen"
msgid "Disable panel indicator"
msgstr "Symbol in der Leiste deaktivieren"
msgid "Disable on-screen notifications"
msgstr "Meldungen auf dem Bildschirm abschalten"
msgid "Persistent over toggles"
msgstr "Nach Umschalten beibehalten"
msgid "Drawing remains when toggling drawing mode"
msgstr ""
"Die Zeichnung bleibt erhalten, wenn der Zeichnungsmodus an- oder "
"ausgeschaltet wird"
msgid "Persistent over restarts"
msgstr "Nach Neustarts beibehalten"
msgid "Drawing is automatically saved to a file"
msgstr "Die Zeichnung wird automatisch in eine Datei gespeichert"
msgid "Enter/leave drawing mode"
msgstr "Zeichnungsmodus starten/beenden"
#. Translators: there is a similar text in GNOME Boxes (https://gitlab.gnome.org/GNOME/gnome-boxes/tree/master/po)
msgid "Grab/ungrab keyboard and pointer"
msgstr "Tastatur und Zeiger ankoppeln/loslösen"
msgid "Background color"
msgstr "Hintergrundfarbe"
msgid "The color of the drawing area background"
msgstr "Hintergrundfarbe der Zeichenfläche"
msgid "Automatic dash array"
msgstr "Automatische Strichdichte"
msgid "Compute the lengths from the line width"
msgstr "Längen aus der Linienbreite berechnen"
msgid "Dash array on"
msgstr "Strichdichte aktiv"
msgid "The dash length in pixels"
msgstr "Strichlänge in Pixel"
msgid "Dash array off"
msgstr "Strichdichte nicht aktiv"
msgid "The gap between the dashes in pixels"
msgstr "Abstand zwischen den Strichen (in Pixel)"
msgid "Dash offset"
msgstr "Strich-Versatz"
msgid "The dash offset in pixels"
msgstr "Versatz der Striche (in Pixel)"
msgid "Grid overlay color"
msgstr "Farbe der Gitterlinien"
msgid "The color of the lines"
msgstr "Die Farbe der Linien"
msgid "Automatic grid overlay line"
msgstr "Automatische Gitternetzlinien"
msgid "Compute the lengths from the screen size"
msgstr "Längen aus der Bildschirmgröße berechnen"
msgid "Grid overlay line spacing"
msgstr "Freiraum zwischen den Gitternetzlinien"
msgid "The gap between lines in pixels"
msgstr "Abstand zwischen den Linien (in Pixel)"
msgid "Grid overlay line width"
msgstr "Stärke der Gitternetzlinien"
msgid "The line width in pixels"
msgstr "Linienbreite in Pixel"
msgid "Image location"
msgstr "Ort der Bilder"
msgid "The location of the directory in which the image tool picks"
msgstr ""
"Verzeichnis mit Bildern, die für das Werkzeug \"Bild\" verwendet werden"
msgid "Color palettes"
msgstr "Farbpaletten"
msgid "The palettes of drawing colors"
msgstr "Paletten mit Zeichenfarben"
msgid "Automatic square area size"
msgstr "Automatische Flächengröße des Rechtecks"
msgid "Compute the area size from the screen size"
msgstr "Flächengröße anhand der Bildschirmgröße berechnen"
msgid "Square area size"
msgstr "Rechteck-Flächengröße"
msgid "The size of the area in pixels"
msgstr "Größe der Fläche (in Pixel)"
msgid "Decrement line width"
msgstr "Linienstärke verringern"
msgid "Decrement line width even more"
msgstr "Linienstärke noch mehr verringern"
msgid "Erase last brushstroke"
msgstr "Letzten Pinselstrich entfernen"
msgid "Export drawing to a SVG file"
msgstr "Zeichnung als SVG-Datei exportieren"
msgid "Increment line width"
msgstr "Linienstärke erhöhen"
msgid "Increment line width even more"
msgstr "Linienstärke noch mehr erhöhen"
msgid "Open next drawing"
msgstr "Nächste Zeichnung öffnen"
msgid "Open preferences"
msgstr "Einstellungen öffnen"
msgid "Open previous drawing"
msgstr "Vorige Zeichnung öffnen"
msgid "Add images from the clipboard"
msgstr "Bilder aus der Zwischenablage einfügen"
msgid "Redo"
msgstr "Wiederherstellen"
msgid "Save drawing"
msgstr "Zeichnung speichern"
msgid "Select color 1"
msgstr "Farbe 1 auswählen"
msgid "Select color 2"
msgstr "Farbe 2 auswählen"
msgid "Select color 3"
msgstr "Farbe 3 auswählen"
msgid "Select color 4"
msgstr "Farbe 4 auswählen"
msgid "Select color 5"
msgstr "Farbe 5 auswählen"
msgid "Select color 6"
msgstr "Farbe 6 auswählen"
msgid "Select color 7"
msgstr "Farbe 7 auswählen"
msgid "Select color 8"
msgstr "Farbe 8 auswählen"
msgid "Select color 9"
msgstr "Farbe 9 auswählen"
msgid "Select ellipse tool"
msgstr "Werkzeug Ellipse auswählen"
msgid "Select image tool"
msgstr "Werkzeug Bild auswählen"
msgid "Select line tool"
msgstr "Werkzeug Linie auswählen"
msgid "Select mirror tool"
msgstr "Werkzeug Spiegeln auswählen"
msgid "Select move tool"
msgstr "Werkzeug Verschieben auswählen"
msgid "Select free drawing"
msgstr "Werkzeug Freies Zeichnen auswählen"
msgid "Select polygon tool"
msgstr "Werkzeug Vieleck auswählen"
msgid "Select polyline tool"
msgstr "Werkzeug Linienzug auswählen"
msgid "Select rectangle tool"
msgstr "Werkzeug Rechteck auswählen"
msgid "Select resize tool"
msgstr "Werkzeug Größenänderung auswählen"
msgid "Select text tool"
msgstr "Werkzeug Text auswählen"
msgid "Smooth last brushstroke"
msgstr "Letzten Pinselstrich glätten"
msgid "Change color palette"
msgstr "Farbpalette wechseln"
msgid "Change color palette (reverse)"
msgstr "Farbpalette wechseln (rückwärts)"
msgid "Toggle fill/outline"
msgstr "Füllen/Außenlinie umschalten"
msgid "Toggle fill rule"
msgstr "Füll-Regel umschalten"
msgid "Change font family"
msgstr "Schriftenfamilie ändern"
msgid "Change font family (reverse)"
msgstr "Schriftenfamilie ändern (rückwärts)"
msgid "Change font style"
msgstr "Schriftart ändern"
msgid "Change font weight"
msgstr "Schriftgröße ändern"
msgid "Change image"
msgstr "Bild ändern"
msgid "Change image (reverse)"
msgstr "Bild ändern (rückwärts)"
msgid "Change linecap"
msgstr "Linien-Kappenstil ändern"
msgid "Change linejoin"
msgstr "Linienverbindung ändern"
msgid "Change text alignment"
msgstr "Textausrichtung ändern"
msgid "Add a drawing background"
msgstr "Zeichnungshintergrund hinzufügen"
msgid "Add a grid overlay"
msgstr "Gitternetz hinzufügen"
msgid "Show help"
msgstr "Hilfe anzeigen"
msgid "Hide panel and dock"
msgstr "Leiste und Dock ausblenden"
#. Translators: It is an action: "Make the drawing area a square"
msgid "Square drawing area"
msgstr "Rechteckigen Zeichnungsbereich erstellen"
msgid "Undo"
msgstr "Rückgängig"
#, javascript-format
#~ msgid "Type your text and press <i>%s</i>"
#~ msgstr ""
#~ "Text eingeben\n"
#~ "Danach <i>%s</i> drücken"
#~ msgid "Redo last brushstroke"
#~ msgstr "Letzten Pinselstrich wiederherstellen"
#~ msgid "Undo last brushstroke"
#~ msgstr "Letzten Pinselstrich wieder entfernen"

View File

@ -8,9 +8,9 @@
# You are free to translate them or not.
msgid ""
msgstr ""
"Project-Id-Version: Draw On Your Screen VERSION\n"
"Report-Msgid-Bugs-To: https://framagit.org/abakkk/DrawOnYourScreen/issues\n"
"POT-Creation-Date: 2019-03-04 16:40+0100\n"
"Project-Id-Version: Draw On Your Screen\n"
"Report-Msgid-Bugs-To: https://codeberg.org/som/DrawOnYourScreen/issues\n"
"POT-Creation-Date: 2021-02-17 14:14+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -19,66 +19,357 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "About"
#. Translators: %s is a key label
#, javascript-format
msgid ""
"Press <i>%s</i> to get\n"
"a fourth control point"
msgstr ""
# You are free to translate the extension name, that is displayed in About page, or not.
msgid "Draw On You Screen"
msgid "Mark a point of symmetry"
msgstr ""
msgid "Version %d"
msgid "Draw a line of symmetry"
msgstr ""
msgid "Start drawing with Super+Alt+D and save your beautiful work by taking a screenshot"
#. Translators: initial content of the text area
msgctxt "text-area-content"
msgid "Text"
msgstr ""
# Add your name here, for example:
# (add "\n" as separator if there is many translators)
# msgid "translator-credits"
# msgstr "Me"
# or, with mail:
# msgid "translator-credits"
# msgstr "<a href=\"mailto:me@mail.org\">Me</a>"
# or, with page:
# msgid "translator-credits"
# msgstr "<a href=\"https://...\">Me</a>"
# else keep it empty.
# It will be displayed in about page
msgid "translator-credits"
#. Translators: %s is a key label
#, javascript-format
msgid "Press <i>%s</i> to mark vertices"
msgstr ""
msgid "Preferences"
#. Translators: %s is a key label
#, javascript-format
msgid ""
"Press <i>%s</i>\n"
"to start a new line"
msgstr ""
#. Translators: It is displayed in an OSD notification to ask the user to start picking, so it should use the imperative mood.
msgctxt "osd-notification"
msgid "Pick a color"
msgstr ""
#. Translators: "released" as the opposite of "grabbed"
msgid "Keyboard and pointer released"
msgstr ""
msgid "Keyboard and pointer grabbed"
msgstr ""
msgid "Leaving drawing mode"
msgstr ""
#. Translators: %s is a key label
#, javascript-format
msgid "Press <i>%s</i> for help"
msgstr ""
msgid "Entering drawing mode"
msgstr ""
msgid "Global"
msgstr ""
msgid "Enter/leave drawing mode"
msgid "Internal"
msgstr ""
# There is a similar text in GNOME Boxes (https://gitlab.gnome.org/GNOME/gnome-boxes/tree/master/po)
msgid "Grab/ungrab keyboard and pointer"
msgid "System"
msgstr ""
msgid "Erase all drawings"
msgid "Dashed line"
msgstr ""
msgid "Persistent"
#. Translators: as the alternative to "Dashed line"
msgid "Full line"
msgstr ""
msgid "Persistent drawing through session restart"
msgid "Fill"
msgstr ""
msgid "Drawing on the desktop"
#. Translators: as the alternative to "Fill"
msgid "Outline"
msgstr ""
msgid "<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>"
#. Translators: fill-rule SVG attribute
msgid "Nonzero"
msgstr ""
msgid "Disable on-screen notifications"
msgid "Evenodd"
msgstr ""
msgid "Disable panel indicator"
#. Translators: generic font-family SVG attribute
msgctxt "font-family"
msgid "Sans-Serif"
msgstr ""
msgctxt "font-family"
msgid "Serif"
msgstr ""
msgctxt "font-family"
msgid "Monospace"
msgstr ""
msgctxt "font-family"
msgid "Cursive"
msgstr ""
msgctxt "font-family"
msgid "Fantasy"
msgstr ""
#. Translators: font-style SVG attribute
msgctxt "font-style"
msgid "Normal"
msgstr ""
msgctxt "font-style"
msgid "Oblique"
msgstr ""
msgctxt "font-style"
msgid "Italic"
msgstr ""
#. Translators: font-weight SVG attribute
msgctxt "font-weight"
msgid "Thin"
msgstr ""
msgctxt "font-weight"
msgid "Ultra Light"
msgstr ""
msgctxt "font-weight"
msgid "Light"
msgstr ""
msgctxt "font-weight"
msgid "Semi Light"
msgstr ""
msgctxt "font-weight"
msgid "Book"
msgstr ""
msgctxt "font-weight"
msgid "Normal"
msgstr ""
msgctxt "font-weight"
msgid "Medium"
msgstr ""
msgctxt "font-weight"
msgid "Semi Bold"
msgstr ""
msgctxt "font-weight"
msgid "Bold"
msgstr ""
msgctxt "font-weight"
msgid "Ultra Bold"
msgstr ""
msgctxt "font-weight"
msgid "Heavy"
msgstr ""
msgctxt "font-weight"
msgid "Ultra Heavy"
msgstr ""
#. Translators: stroke-linecap SVG attribute
msgctxt "stroke-linecap"
msgid "Butt"
msgstr ""
msgctxt "stroke-linecap"
msgid "Round"
msgstr ""
msgctxt "stroke-linecap"
msgid "Square"
msgstr ""
#. Translators: stroke-linejoin SVG attribute
msgctxt "stroke-linejoin"
msgid "Miter"
msgstr ""
msgctxt "stroke-linejoin"
msgid "Round"
msgstr ""
msgctxt "stroke-linejoin"
msgid "Bevel"
msgstr ""
#. Translators: value in pixel unit (e.g. "5 px")
#, javascript-format
msgid "%f px"
msgstr ""
msgid "Left aligned"
msgstr ""
msgid "Centered"
msgstr ""
msgid "Right aligned"
msgstr ""
msgctxt "drawing-tool"
msgid "Free drawing"
msgstr ""
msgctxt "drawing-tool"
msgid "Line"
msgstr ""
msgctxt "drawing-tool"
msgid "Ellipse"
msgstr ""
msgctxt "drawing-tool"
msgid "Rectangle"
msgstr ""
msgctxt "drawing-tool"
msgid "Text"
msgstr ""
msgctxt "drawing-tool"
msgid "Polygon"
msgstr ""
msgctxt "drawing-tool"
msgid "Polyline"
msgstr ""
msgctxt "drawing-tool"
msgid "Image"
msgstr ""
msgctxt "drawing-tool"
msgid "Move"
msgstr ""
msgctxt "drawing-tool"
msgid "Resize"
msgstr ""
msgctxt "drawing-tool"
msgid "Mirror"
msgstr ""
msgid "Erase"
msgstr ""
msgid "Smooth"
msgstr ""
msgid "Open drawing"
msgstr ""
msgid "Save drawing as…"
msgstr ""
msgid "Palette"
msgstr ""
msgid "Color"
msgstr ""
#. Translators: It is displayed in a menu button tooltip or as a shortcut action description, so it should NOT use the imperative mood.
msgid "Pick a color"
msgstr ""
msgid "Add to images"
msgstr ""
msgid "Delete"
msgstr ""
msgid "Type a name"
msgstr ""
#. Translators: "Preferences" page in preferences
msgid "Preferences"
msgstr ""
#. Translators: "Drawing" page in preferences
msgid "Drawing"
msgstr ""
#. Translators: "About" page in preferences
msgid "About"
msgstr ""
#. Translators: you are free to translate the extension name, that is displayed in About page, or not
msgid "Draw On You Screen"
msgstr ""
#. Translators: version number in "About" page
#, javascript-format
msgid "Version %f"
msgstr ""
#. Translators: you are free to translate the extension description, that is displayed in About page, or not
msgid ""
"Start drawing with Super+Alt+D and save your beautiful work by taking a "
"screenshot"
msgstr ""
#. Translators: add your name here or keep it empty, it will be displayed in about page, e.g.
#. msgstr ""
#. "translator1\n"
#. "<a href=\"mailto:translator2@mail.org\">translator2</a>\n"
#. "<a href=\"https://...\">translator3</a>"
msgid "translator-credits"
msgstr ""
msgid "Palettes"
msgstr ""
msgid "Add a new palette"
msgstr ""
msgid "Area"
msgstr ""
msgid "Auto"
msgstr ""
msgid "Grid overlay line"
msgstr ""
msgid "Tools"
msgstr ""
msgid "Dash array"
msgstr ""
msgid "Reset settings"
msgstr ""
msgid "Rename the palette"
msgstr ""
msgid "Remove the palette"
msgstr ""
#. Translators: default name of a new palette
msgid "New palette"
msgstr ""
msgid "In drawing mode"
msgstr ""
msgid "Draw"
@ -102,17 +393,19 @@ msgstr ""
msgid "Scroll"
msgstr ""
#. Translators: %s are key labels (Ctrl+F1 and Ctrl+F9)
msgid "Select color"
msgstr ""
# %s are key labels (Ctrl+F1 and Ctrl+F9)
#, javascript-format
msgid "%s … %s"
msgstr ""
#. Translators: %s is a key label
msgid "Ignore pointer movement"
msgstr ""
# %s is a key label
#, javascript-format
msgid "%s held"
msgstr ""
@ -137,6 +430,9 @@ msgstr ""
msgid "Smooth free drawing outline"
msgstr ""
msgid "Do not preserve image ratio"
msgstr ""
msgid "Rotate <span alpha=\"50%\">(while moving)</span>"
msgstr ""
@ -146,73 +442,224 @@ msgstr ""
msgid "Inverse <span alpha=\"50%\">(while mirroring)</span>"
msgstr ""
msgid "Internal"
msgid "Drawing on the desktop"
msgstr ""
msgid "(in drawing mode)"
msgid "<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>"
msgstr ""
msgid "Undo last brushstroke"
msgid "Erase all drawings"
msgstr ""
msgid "Redo last brushstroke"
msgid "Disable panel indicator"
msgstr ""
msgid "Erase last brushstroke"
msgid "Disable on-screen notifications"
msgstr ""
msgid "Smooth last brushstroke"
msgid "Persistent over toggles"
msgstr ""
msgid "Select line"
msgid "Drawing remains when toggling drawing mode"
msgstr ""
msgid "Select ellipse"
msgid "Persistent over restarts"
msgstr ""
msgid "Select rectangle"
msgid "Drawing is automatically saved to a file"
msgstr ""
msgid "Select polygon"
msgid "Enter/leave drawing mode"
msgstr ""
msgid "Select polyline"
#. Translators: there is a similar text in GNOME Boxes (https://gitlab.gnome.org/GNOME/gnome-boxes/tree/master/po)
msgid "Grab/ungrab keyboard and pointer"
msgstr ""
msgid "Select image"
msgid "Background color"
msgstr ""
msgid "Select text"
msgid "The color of the drawing area background"
msgstr ""
msgid "Select move"
msgid "Automatic dash array"
msgstr ""
msgid "Select resize"
msgid "Compute the lengths from the line width"
msgstr ""
msgid "Select mirror"
msgid "Dash array on"
msgstr ""
msgid "Toggle fill/outline"
msgid "The dash length in pixels"
msgstr ""
msgid "Increment line width"
msgid "Dash array off"
msgstr ""
msgid "The gap between the dashes in pixels"
msgstr ""
msgid "Dash offset"
msgstr ""
msgid "The dash offset in pixels"
msgstr ""
msgid "Grid overlay color"
msgstr ""
msgid "The color of the lines"
msgstr ""
msgid "Automatic grid overlay line"
msgstr ""
msgid "Compute the lengths from the screen size"
msgstr ""
msgid "Grid overlay line spacing"
msgstr ""
msgid "The gap between lines in pixels"
msgstr ""
msgid "Grid overlay line width"
msgstr ""
msgid "The line width in pixels"
msgstr ""
msgid "Image location"
msgstr ""
msgid "The location of the directory in which the image tool picks"
msgstr ""
msgid "Color palettes"
msgstr ""
msgid "The palettes of drawing colors"
msgstr ""
msgid "Automatic square area size"
msgstr ""
msgid "Compute the area size from the screen size"
msgstr ""
msgid "Square area size"
msgstr ""
msgid "The size of the area in pixels"
msgstr ""
msgid "Decrement line width"
msgstr ""
msgid "Increment line width even more"
msgstr ""
msgid "Decrement line width even more"
msgstr ""
msgid "Change linejoin"
msgid "Erase last brushstroke"
msgstr ""
msgid "Change linecap"
msgid "Export drawing to a SVG file"
msgstr ""
msgid "Increment line width"
msgstr ""
msgid "Increment line width even more"
msgstr ""
msgid "Open next drawing"
msgstr ""
msgid "Open preferences"
msgstr ""
msgid "Open previous drawing"
msgstr ""
msgid "Add images from the clipboard"
msgstr ""
msgid "Redo"
msgstr ""
msgid "Save drawing"
msgstr ""
msgid "Select color 1"
msgstr ""
msgid "Select color 2"
msgstr ""
msgid "Select color 3"
msgstr ""
msgid "Select color 4"
msgstr ""
msgid "Select color 5"
msgstr ""
msgid "Select color 6"
msgstr ""
msgid "Select color 7"
msgstr ""
msgid "Select color 8"
msgstr ""
msgid "Select color 9"
msgstr ""
msgid "Select ellipse tool"
msgstr ""
msgid "Select image tool"
msgstr ""
msgid "Select line tool"
msgstr ""
msgid "Select mirror tool"
msgstr ""
msgid "Select move tool"
msgstr ""
msgid "Select free drawing"
msgstr ""
msgid "Select polygon tool"
msgstr ""
msgid "Select polyline tool"
msgstr ""
msgid "Select rectangle tool"
msgstr ""
msgid "Select resize tool"
msgstr ""
msgid "Select text tool"
msgstr ""
msgid "Smooth last brushstroke"
msgstr ""
msgid "Change color palette"
msgstr ""
msgid "Change color palette (reverse)"
msgstr ""
msgid "Toggle fill/outline"
msgstr ""
msgid "Toggle fill rule"
@ -224,19 +671,25 @@ msgstr ""
msgid "Change font family (reverse)"
msgstr ""
msgid "Change font weight"
msgstr ""
msgid "Change font style"
msgstr ""
msgid "Toggle text alignment"
msgid "Change font weight"
msgstr ""
msgid "Change image file"
msgid "Change image"
msgstr ""
msgid "Hide panel and dock"
msgid "Change image (reverse)"
msgstr ""
msgid "Change linecap"
msgstr ""
msgid "Change linejoin"
msgstr ""
msgid "Change text alignment"
msgstr ""
msgid "Add a drawing background"
@ -245,268 +698,15 @@ msgstr ""
msgid "Add a grid overlay"
msgstr ""
msgid "Square drawing area"
msgstr ""
msgid "Open previous drawing"
msgstr ""
msgid "Open next drawing"
msgstr ""
msgid "Save drawing as a SVG file"
msgstr ""
msgid "Edit style"
msgstr ""
msgid "Open preferences"
msgstr ""
msgid "Show help"
msgstr ""
msgid ""
"<b>Default</b> drawing style attributes (color palette, font, line, dash) are defined in an editable <b>css</b> file.\n"
"See <i>“%s”</i>."
msgid "Hide panel and dock"
msgstr ""
msgid ""
"When you save elements made with <b>eraser</b> in a <b>SVG</b> file, "
"they are colored with background color, transparent if it is disabled.\n"
"See <i>“%s”</i> or edit the SVG file afterwards."
msgstr ""
msgid "Screenshot"
msgstr ""
msgid "Screenshot to clipboard"
msgstr ""
msgid "Area screenshot"
msgstr ""
msgid "Area screenshot to clipboard"
msgstr ""
msgid "System"
#. Translators: It is an action: "Make the drawing area a square"
msgid "Square drawing area"
msgstr ""
msgid "Undo"
msgstr ""
msgid "Redo"
msgstr ""
msgid "Erase"
msgstr ""
msgid "Smooth"
msgstr ""
msgid "Free drawing"
msgstr ""
msgid "Line"
msgstr ""
msgid "Ellipse"
msgstr ""
msgid "Rectangle"
msgstr ""
msgid "Text"
msgstr ""
msgid "Polygon"
msgstr ""
msgid "Polyline"
msgstr ""
msgid "Image"
msgstr ""
msgid "Move"
msgstr ""
msgid "Resize"
msgstr ""
msgid "Mirror"
msgstr ""
msgid "Color"
msgstr ""
msgid "Fill"
msgstr ""
# fill-rule SVG attribute
msgid "Evenodd"
msgstr ""
msgid "%d px"
msgstr ""
# stroke-linejoin SVG attribute
msgid "Miter"
msgstr ""
# stroke-linejoin and stroke-linecap SVG attribute
msgid "Round"
msgstr ""
# stroke-linejoin SVG attribute
msgid "Bevel"
msgstr ""
# stroke-linecap SVG attribute
msgid "Butt"
msgstr ""
# stroke-linecap SVG attribute
msgid "Square"
msgstr ""
msgid "Dashed"
msgstr ""
# generic font-family SVG attribute
msgid "Sans-Serif"
msgstr ""
# generic font-family SVG attribute
msgid "Serif"
msgstr ""
# generic font-family SVG attribute
msgid "Monospace"
msgstr ""
# generic font-family SVG attribute
msgid "Cursive"
msgstr ""
# generic font-family SVG attribute
msgid "Fantasy"
msgstr ""
# font-weight SVG attribute
msgid "Thin"
msgstr ""
# font-weight SVG attribute
msgid "Ultra-light"
msgstr ""
# font-weight SVG attribute
msgid "Light"
msgstr ""
# font-weight SVG attribute
msgid "Semi-light"
msgstr ""
# font-weight SVG attribute
msgid "Book"
msgstr ""
# font-weight and font-style SVG attribute
msgid "Normal"
msgstr ""
# font-weight SVG attribute
msgid "Medium"
msgstr ""
# font-weight SVG attribute
msgid "Semi-bold"
msgstr ""
# font-weight SVG attribute
msgid "Bold"
msgstr ""
# font-weight SVG attribute
msgid "Ultra-bold"
msgstr ""
# font-weight SVG attribute
msgid "Heavy"
msgstr ""
# font-style SVG attribute
msgid "Italic"
msgstr ""
# font-style SVG attribute
msgid "Oblique"
msgstr ""
msgid "Right aligned"
msgstr ""
msgid "Open drawing"
msgstr ""
msgid "Save drawing"
msgstr ""
msgid "Leaving drawing mode"
msgstr ""
# %s is a key label
msgid "<small>Press <i>%s</i> for help</small>"
msgstr ""
msgid "Entering drawing mode"
msgstr ""
# "released" as the opposite of "grabbed"
msgid "Keyboard and pointer released"
msgstr ""
msgid "Keyboard and pointer grabbed"
msgstr ""
# %s is a key label
msgid ""
"Press <i>%s</i> to get\n"
"a fourth control point"
msgstr ""
msgid "Mark a point of symmetry"
msgstr ""
msgid "Draw a line of symmetry"
msgstr ""
# %s is a key label
msgid ""
"Press <i>%s</i> to mark vertices"
msgstr ""
# %s is a key label
msgid ""
"Type your text and press <i>%s</i>"
msgstr ""
# as the alternative to "Fill"
msgid "Outline"
msgstr ""
msgid "Dashed line"
msgstr ""
msgid "Full line"
msgstr ""
msgid "Left aligned"
msgstr ""
msgid "Nonzero"
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Draw On Your Desktop\n"
"Report-Msgid-Bugs-To: https://framagit.org/abakkk/DrawOnYourScreen/issues\n"
"Report-Msgid-Bugs-To: https://codeberg.org/som/DrawOnYourScreen/issues\n"
"POT-Creation-Date: 2020-03-06 18:46+0100\n"
"PO-Revision-Date: 2020-03-06 19:05+0100\n"
"Language-Team: Albano Battistella <albano_battistella@hotmail.com>\n"

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Draw On Your Screen VERSION\n"
"Report-Msgid-Bugs-To: https://framagit.org/abakkk/DrawOnYourScreen/issues\n"
"Report-Msgid-Bugs-To: https://codeberg.org/som/DrawOnYourScreen/issues\n"
"POT-Creation-Date: 2019-03-04 16:40+0100\n"
"PO-Revision-Date: 2019-10-17 17:54+0300\n"
"Language-Team: \n"

File diff suppressed because it is too large Load Diff

649
menu.js
View File

@ -1,14 +1,9 @@
/* jslint esversion: 6 */
/*
* Copyright 2019 Abakkk
*
* This file is part of DrawOnYourScreen, a drawing extension for GNOME Shell.
* https://framagit.org/abakkk/DrawOnYourScreen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@ -18,10 +13,15 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-FileCopyrightText: 2019 Abakkk
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/* jslint esversion: 6 */
/* exported DisplayStrings, DrawingMenu */
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
@ -30,52 +30,136 @@ const St = imports.gi.St;
const BoxPointer = imports.ui.boxpointer;
const Config = imports.misc.config;
const Dash = imports.ui.dash;
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const Slider = imports.ui.slider;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Area = Me.imports.area;
const Elements = Me.imports.elements;
const Extension = Me.imports.extension;
const Files = Me.imports.files;
const _ = imports.gettext.domain(Me.metadata['gettext-domain']).gettext;
const pgettext = imports.gettext.domain(Me.metadata['gettext-domain']).pgettext;
const GS_VERSION = Config.PACKAGE_VERSION;
const ICON_DIR = Me.dir.get_child('data').get_child('icons');
const SMOOTH_ICON_PATH = ICON_DIR.get_child('smooth-symbolic.svg').get_path();
const COLOR_ICON_PATH = ICON_DIR.get_child('color-symbolic.svg').get_path();
const FILL_ICON_PATH = ICON_DIR.get_child('fill-symbolic.svg').get_path();
const STROKE_ICON_PATH = ICON_DIR.get_child('stroke-symbolic.svg').get_path();
const LINEJOIN_ICON_PATH = ICON_DIR.get_child('linejoin-symbolic.svg').get_path();
const LINECAP_ICON_PATH = ICON_DIR.get_child('linecap-symbolic.svg').get_path();
const FILLRULE_NONZERO_ICON_PATH = ICON_DIR.get_child('fillrule-nonzero-symbolic.svg').get_path();
const FILLRULE_EVENODD_ICON_PATH = ICON_DIR.get_child('fillrule-evenodd-symbolic.svg').get_path();
const DASHED_LINE_ICON_PATH = ICON_DIR.get_child('dashed-line-symbolic.svg').get_path();
const FULL_LINE_ICON_PATH = ICON_DIR.get_child('full-line-symbolic.svg').get_path();
// 150 labels with font-family style take ~15Mo
const FONT_FAMILY_STYLE = true;
// use 'login-dialog-message-warning' class in order to get GS theme warning color (default: #f57900)
const WARNING_COLOR_STYLE_CLASS_NAME = 'login-dialog-message-warning';
const UUID = Me.uuid.replace(/@/gi, '_at_').replace(/[^a-z0-9+_-]/gi, '_');
const TextAlignmentIcon = { 0: Files.Icons.LEFT_ALIGNED, 1: Files.Icons.CENTERED, 2: Files.Icons.RIGHT_ALIGNED };
const getActor = function(object) {
return GS_VERSION < '3.33.0' ? object.actor : object;
};
var DrawingMenu = new Lang.Class({
Name: 'DrawOnYourScreenDrawingMenu',
const getSummary = function(settingKey) {
return Me.internalShortcutSettings.settings_schema.get_key(settingKey).get_summary();
};
_init: function(area, monitor) {
// Used by both menu and osd notifications.
var DisplayStrings = {
getDashedLine: function(dashed) {
return dashed ? _("Dashed line") :
// Translators: as the alternative to "Dashed line"
_("Full line");
},
getFill: function(fill) {
return fill ? _("Fill") :
// Translators: as the alternative to "Fill"
_("Outline");
},
get FillRule() {
if (!this._FillRule)
// Translators: fill-rule SVG attribute
this._FillRule = { 0: _("Nonzero"), 1: _("Evenodd") };
return this._FillRule;
},
getFontFamily: function(family) {
if (!this._FontGenericFamily)
// Translators: generic font-family SVG attribute
this._FontGenericFamily = { 'Sans-Serif': pgettext("font-family", "Sans-Serif"), 'Serif': pgettext("font-family", "Serif"),
'Monospace': pgettext("font-family", "Monospace"), 'Cursive': pgettext("font-family", "Cursive"),
'Fantasy': pgettext("font-family", "Fantasy") };
return this._FontGenericFamily[family] || family;
},
get FontStyle() {
if (!this._FontStyle)
// Translators: font-style SVG attribute
this._FontStyle = { 0: pgettext("font-style", "Normal"), 1: pgettext("font-style", "Oblique"), 2: pgettext("font-style", "Italic") };
return this._FontStyle;
},
FontStyleMarkup: { 0: 'normal', 1: 'oblique', 2: 'italic' },
get FontWeight() {
if (!this._FontWeight)
// Translators: font-weight SVG attribute
this._FontWeight = { 100: pgettext("font-weight", "Thin"), 200: pgettext("font-weight", "Ultra Light"), 300: pgettext("font-weight", "Light"),
350: pgettext("font-weight", "Semi Light"), 380: pgettext("font-weight", "Book"), 400: pgettext("font-weight", "Normal"),
500: pgettext("font-weight", "Medium"), 600: pgettext("font-weight", "Semi Bold"), 700: pgettext("font-weight", "Bold"),
800: pgettext("font-weight", "Ultra Bold"), 900: pgettext("font-weight", "Heavy"), 1000: pgettext("font-weight", "Ultra Heavy") };
return this._FontWeight;
},
get LineCap() {
if (!this._LineCap)
// Translators: stroke-linecap SVG attribute
this._LineCap = { 0: pgettext("stroke-linecap", "Butt"), 1: pgettext("stroke-linecap", "Round"), 2: pgettext("stroke-linecap", "Square") };
return this._LineCap;
},
get LineJoin() {
if (!this._LineJoin)
// Translators: stroke-linejoin SVG attribute
this._LineJoin = { 0: pgettext("stroke-linejoin", "Miter"), 1: pgettext("stroke-linejoin", "Round"), 2: pgettext("stroke-linejoin", "Bevel") };
return this._LineJoin;
},
getPixels(value) {
// Translators: value in pixel unit (e.g. "5 px")
return _("%f px").format(value);
},
get TextAlignment() {
// Translators: text alignment
if (!this._TextAlignment)
this._TextAlignment = { 0: _("Left aligned"), 1: _("Centered"), 2: _("Right aligned") };
return this._TextAlignment;
},
get Tool() {
if (!this._Tool)
this._Tool = { 0: pgettext("drawing-tool", "Free drawing"), 1: pgettext("drawing-tool", "Line"), 2: pgettext("drawing-tool", "Ellipse"),
3: pgettext("drawing-tool", "Rectangle"), 4: pgettext("drawing-tool", "Text"), 5: pgettext("drawing-tool", "Polygon"),
6: pgettext("drawing-tool", "Polyline"), 7: pgettext("drawing-tool", "Image"),
100: pgettext("drawing-tool", "Move"), 101: pgettext("drawing-tool", "Resize"), 102: pgettext("drawing-tool", "Mirror") };
return this._Tool;
}
};
var DrawingMenu = new Lang.Class({
Name: `${UUID}-DrawingMenu`,
_init: function(area, monitor, DrawingTool, areaManagerUtils) {
this.area = area;
this.monitor = monitor;
this.DrawingTool = DrawingTool;
this.areaManagerUtils = areaManagerUtils;
let side = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL ? St.Side.RIGHT : St.Side.LEFT;
this.menu = new PopupMenu.PopupMenu(Main.layoutManager.dummyCursor, 0.25, side);
this.menuManager = new PopupMenu.PopupMenuManager(GS_VERSION < '3.33.0' ? { actor: this.area } : this.area);
this.menuManager.addMenu(this.menu);
Main.layoutManager.uiGroup.add_actor(this.menu.actor);
this.menu.actor.add_style_class_name('background-menu draw-on-your-screen-menu');
this.menu.actor.set_style('max-height:' + monitor.height + 'px;');
this.menu.actor.hide();
this.hasSeparators = monitor.height >= 750;
@ -94,20 +178,12 @@ var DrawingMenu = new Lang.Class({
this.saveDrawingSubMenu.close();
menuCloseFunc.bind(this.menu)(animate);
};
this.colorIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(COLOR_ICON_PATH) });
this.smoothIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(SMOOTH_ICON_PATH) });
this.strokeIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(STROKE_ICON_PATH) });
this.fillIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(FILL_ICON_PATH) });
this.fillRuleNonzeroIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(FILLRULE_NONZERO_ICON_PATH) });
this.fillRuleEvenoddIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(FILLRULE_EVENODD_ICON_PATH) });
this.linejoinIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(LINEJOIN_ICON_PATH) });
this.linecapIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(LINECAP_ICON_PATH) });
this.fullLineIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(FULL_LINE_ICON_PATH) });
this.dashedLineIcon = new Gio.FileIcon({ file: Gio.File.new_for_path(DASHED_LINE_ICON_PATH) });
},
disable: function() {
delete this.area;
delete this.DrawingTool;
delete this.areaManagerUtils;
this.menuManager.removeMenu(this.menu);
Main.layoutManager.uiGroup.remove_actor(this.menu.actor);
this.menu.destroy();
@ -122,6 +198,11 @@ var DrawingMenu = new Lang.Class({
this.area.updateActionMode();
this.area.grab_key_focus();
}
let workArea = Main.layoutManager.getWorkAreaForMonitor(this.monitor.index);
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let maxHeight = Math.round(workArea.height / scaleFactor);
this.menu.actor.set_style(`max-height:${maxHeight}px;`);
},
popup: function() {
@ -154,106 +235,97 @@ var DrawingMenu = new Lang.Class({
_redisplay: function() {
this.menu.removeAll();
this.actionButtons = [];
let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: "draw-on-your-screen-menu-group-item" });
getActor(groupItem).add_child(this._createActionButton(_("Undo"), this.area.undo.bind(this.area), 'edit-undo-symbolic'));
getActor(groupItem).add_child(this._createActionButton(_("Redo"), this.area.redo.bind(this.area), 'edit-redo-symbolic'));
getActor(groupItem).add_child(this._createActionButton(_("Erase"), this.area.deleteLastElement.bind(this.area), 'edit-clear-all-symbolic'));
getActor(groupItem).add_child(this._createActionButton(_("Smooth"), this.area.smoothLastElement.bind(this.area), this.smoothIcon));
let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: 'draw-on-your-screen-menu-group-item' });
this.undoButton = new ActionButton(getSummary('undo'), 'edit-undo-symbolic', this.area.undo.bind(this.area), this._updateActionSensitivity.bind(this));
this.redoButton = new ActionButton(getSummary('redo'), 'edit-redo-symbolic', this.area.redo.bind(this.area), this._updateActionSensitivity.bind(this));
this.eraseButton = new ActionButton(_("Erase"), 'edit-clear-all-symbolic', this.area.deleteLastElement.bind(this.area), this._updateActionSensitivity.bind(this));
this.smoothButton = new ActionButton(_("Smooth"), Files.Icons.SMOOTH, this.area.smoothLastElement.bind(this.area), this._updateActionSensitivity.bind(this));
this.eraseButton.child.add_style_class_name('draw-on-your-screen-menu-destructive-button');
getActor(groupItem).add_child(this.undoButton);
getActor(groupItem).add_child(this.redoButton);
getActor(groupItem).add_child(this.eraseButton);
getActor(groupItem).add_child(this.smoothButton);
this.menu.addMenuItem(groupItem);
this._addSeparator(this.menu, true);
this._addSubMenuItem(this.menu, 'document-edit-symbolic', Area.ToolNames, this.area, 'currentTool', this._updateSectionVisibility.bind(this));
this.colorItem = this._addColorSubMenuItem(this.menu);
this.fillItem = this._addSwitchItem(this.menu, _("Fill"), this.strokeIcon, this.fillIcon, this.area, 'fill', this._updateSectionVisibility.bind(this));
this.toolItem = this._addToolSubMenuItem(this.menu, this._updateSectionVisibility.bind(this));
this.paletteItem = this._addPaletteSubMenuItem(this.menu, Files.Icons.PALETTE);
this.colorItem = this._addColorSubMenuItem(this.menu, Files.Icons.COLOR);
this.fillItem = this._addSwitchItem(this.menu, DisplayStrings.getFill(true), Files.Icons.STROKE, Files.Icons.FILL, this.area, 'fill', this._updateSectionVisibility.bind(this));
this.fillSection = new PopupMenu.PopupMenuSection();
this.fillSection.itemActivated = () => {};
this.fillRuleItem = this._addSwitchItem(this.fillSection, _("Evenodd"), this.fillRuleNonzeroIcon, this.fillRuleEvenoddIcon, this.area, 'currentEvenodd');
this.fillRuleItem = this._addSwitchItem(this.fillSection, DisplayStrings.FillRule[1], Files.Icons.FILLRULE_NONZERO, Files.Icons.FILLRULE_EVENODD, this.area, 'currentEvenodd');
this.menu.addMenuItem(this.fillSection);
this._addSeparator(this.menu);
let lineSection = new PopupMenu.PopupMenuSection();
this._addSliderItem(lineSection, this.area, 'currentLineWidth');
this._addSubMenuItem(lineSection, this.linejoinIcon, Elements.LineJoinNames, this.area, 'currentLineJoin');
this._addSubMenuItem(lineSection, this.linecapIcon, Elements.LineCapNames, this.area, 'currentLineCap');
this._addSwitchItem(lineSection, _("Dashed"), this.fullLineIcon, this.dashedLineIcon, this.area, 'dashedLine');
this._addSubMenuItem(lineSection, Files.Icons.LINEJOIN, DisplayStrings.LineJoin, this.area, 'currentLineJoin');
this._addSubMenuItem(lineSection, Files.Icons.LINECAP, DisplayStrings.LineCap, this.area, 'currentLineCap');
this._addSwitchItem(lineSection, DisplayStrings.getDashedLine(true), Files.Icons.FULL_LINE, Files.Icons.DASHED_LINE, this.area, 'dashedLine');
this._addSeparator(lineSection);
this.menu.addMenuItem(lineSection);
lineSection.itemActivated = () => {};
this.lineSection = lineSection;
let fontSection = new PopupMenu.PopupMenuSection();
this._addFontFamilySubMenuItem(fontSection, 'font-x-generic-symbolic');
this._addSubMenuItem(fontSection, 'format-text-bold-symbolic', Elements.FontWeightNames, this.area, 'currentFontWeight');
this._addSubMenuItem(fontSection, 'format-text-italic-symbolic', Elements.FontStyleNames, this.area, 'currentFontStyle');
this._addSwitchItem(fontSection, _("Right aligned"), 'format-justify-left-symbolic', 'format-justify-right-symbolic', this.area, 'currentTextRightAligned');
this._addFontFamilySubMenuItem(fontSection, Files.Icons.FONT_FAMILY);
this._addSubMenuItem(fontSection, Files.Icons.FONT_WEIGHT, DisplayStrings.FontWeight, this.area, 'currentFontWeight');
this._addSubMenuItem(fontSection, Files.Icons.FONT_STYLE, DisplayStrings.FontStyle, this.area, 'currentFontStyle');
this._addTextAlignmentSubMenuItem(fontSection);
this._addSeparator(fontSection);
this.menu.addMenuItem(fontSection);
fontSection.itemActivated = () => {};
this.fontSection = fontSection;
let imageSection = new PopupMenu.PopupMenuSection();
let images = this.area.getImages();
if (images.length) {
if (this.area.currentImage > images.length - 1)
this.area.currentImage = images.length - 1;
this._addSubMenuItem(imageSection, null, images, this.area, 'currentImage');
}
this.imageItem = this._addImageSubMenuItem(imageSection);
this._addSeparator(imageSection);
this.menu.addMenuItem(imageSection);
imageSection.itemActivated = () => {};
this.imageSection = imageSection;
let manager = Extension.manager;
this._addSimpleSwitchItem(this.menu, _("Hide panel and dock"), manager.hiddenList ? true : false, manager.togglePanelAndDockOpacity.bind(manager));
this._addSimpleSwitchItem(this.menu, _("Add a drawing background"), this.area.hasBackground, this.area.toggleBackground.bind(this.area));
this._addSimpleSwitchItem(this.menu, _("Add a grid overlay"), this.area.hasGrid, this.area.toggleGrid.bind(this.area));
this._addSimpleSwitchItem(this.menu, _("Square drawing area"), this.area.isSquareArea, this.area.toggleSquareArea.bind(this.area));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-panel-and-dock-visibility'), !!this.areaManagerUtils.getHiddenList(), this.areaManagerUtils.togglePanelAndDockOpacity);
this._addSimpleSwitchItem(this.menu, getSummary('toggle-background'), this.area.hasBackground, this.area.toggleBackground.bind(this.area));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-grid'), this.area.hasGrid, this.area.toggleGrid.bind(this.area));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-square-area'), this.area.isSquareArea, this.area.toggleSquareArea.bind(this.area));
this._addSeparator(this.menu);
this._addDrawingNameItem(this.menu);
this._addOpenDrawingSubMenuItem(this.menu);
this._addSaveDrawingSubMenuItem(this.menu);
this._addOpenDrawingSubMenuItem(this.menu, _("Open drawing"), 'document-open-symbolic');
this._addSaveDrawingSubMenuItem(this.menu, _("Save drawing as…"), 'document-save-as-symbolic');
this._addSeparator(this.menu);
this.menu.addAction(_("Save drawing as a SVG file"), this.area.saveAsSvg.bind(this.area), 'image-x-generic-symbolic');
this.menu.addAction(_("Edit style"), manager.openUserStyleFile.bind(manager), 'document-page-setup-symbolic');
this.menu.addAction(_("Show help"), () => { this.close(); this.area.toggleHelp(); }, 'preferences-desktop-keyboard-shortcuts-symbolic');
groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: 'draw-on-your-screen-menu-group-item' });
this.saveButton = new ActionButton(getSummary('save-as-json'), 'document-save-symbolic', this.area.saveAsJson.bind(this.area, false, this._onDrawingSaved.bind(this)), null);
this.svgButton = new ActionButton(getSummary('export-to-svg'), Files.Icons.DOCUMENT_EXPORT, this.area.exportToSvg.bind(this.area), null);
this.prefsButton = new ActionButton(getSummary('open-preferences'), 'document-page-setup-symbolic', this.areaManagerUtils.openPreferences, null);
this.helpButton = new ActionButton(getSummary('toggle-help'), 'preferences-desktop-keyboard-shortcuts-symbolic', () => { this.close(); this.area.toggleHelp(); }, null);
getActor(groupItem).add_child(this.saveButton);
getActor(groupItem).add_child(this.svgButton);
getActor(groupItem).add_child(this.prefsButton);
getActor(groupItem).add_child(this.helpButton);
this.menu.addMenuItem(groupItem);
this._updateActionSensitivity();
this._updateSectionVisibility();
},
// from system.js (GS 3.34-)
_createActionButton: function(accessibleName, callback, icon) {
let button = new St.Button({ track_hover: true,
x_align: Clutter.ActorAlign.CENTER,
accessible_name: accessibleName,
// use 'popup-menu' and 'popup-menu-item' style classes to provide theme colors
style_class: 'system-menu-action popup-menu-item popup-menu' });
button.child = new St.Icon(typeof icon == 'string' ? { icon_name: icon } : { gicon: icon });
button.connect('clicked', () => {
callback();
this._updateActionSensitivity();
});
button.bind_property('reactive', button, 'can_focus', GObject.BindingFlags.DEFAULT);
this.actionButtons.push(button);
return new St.Bin({ child: button, x_expand: true });
},
_updateActionSensitivity: function() {
let [undoButton, redoButton, eraseButton, smoothButton] = this.actionButtons;
undoButton.reactive = this.area.elements.length > 0;
redoButton.reactive = this.area.undoneElements.length > 0;
eraseButton.reactive = this.area.elements.length > 0;
smoothButton.reactive = this.area.elements.length > 0 && this.area.elements[this.area.elements.length - 1].shape == Area.Tools.NONE;
this.undoButton.child.reactive = this.area.elements.length > 0;
this.redoButton.child.reactive = this.area.undoneElements.length > 0 || (this.area.elements.length && this.area.elements[this.area.elements.length - 1].canUndo);
this.eraseButton.child.reactive = this.area.elements.length > 0;
this.smoothButton.child.reactive = this.area.elements.length > 0 && this.area.elements[this.area.elements.length - 1].shape == this.DrawingTool.NONE;
this.saveButton.child.reactive = this.area.elements.length > 0;
this.svgButton.child.reactive = this.area.elements.length > 0;
this.saveDrawingSubMenuItem.setSensitive(this.area.elements.length > 0);
},
_updateSectionVisibility: function() {
let [isText, isImage] = [this.area.currentTool == Area.Tools.TEXT, this.area.currentTool == Area.Tools.IMAGE];
let [isText, isImage] = [this.area.currentTool == this.DrawingTool.TEXT, this.area.currentTool == this.DrawingTool.IMAGE];
this.lineSection.actor.visible = !isText && !isImage;
this.fontSection.actor.visible = isText;
this.imageSection.actor.visible = isImage;
this.colorItem.setSensitive(!isImage);
this.fillItem.setSensitive(!isText && !isImage);
this.fillSection.setSensitive(!isText && !isImage);
@ -269,18 +341,14 @@ var DrawingMenu = new Lang.Class({
item.icon = new St.Icon({ style_class: 'popup-menu-icon' });
getActor(item).insert_child_at_index(item.icon, 1);
let icon = target[targetProperty] ? iconTrue : iconFalse;
if (icon && icon instanceof GObject.Object && GObject.type_is_a(icon, Gio.Icon))
if (icon)
item.icon.set_gicon(icon);
else if (icon)
item.icon.set_icon_name(icon);
item.connect('toggled', (item, state) => {
target[targetProperty] = state;
let icon = target[targetProperty] ? iconTrue : iconFalse;
if (icon && icon instanceof GObject.Object && GObject.type_is_a(icon, Gio.Icon))
if (icon)
item.icon.set_gicon(icon);
else if (icon)
item.icon.set_icon_name(icon);
if (onToggled)
onToggled();
});
@ -296,26 +364,26 @@ var DrawingMenu = new Lang.Class({
_addSliderItem: function(menu, target, targetProperty) {
let item = new PopupMenu.PopupBaseMenuItem({ activate: false });
let label = new St.Label({ text: _("%d px").format(target[targetProperty]), style_class: 'draw-on-your-screen-menu-slider-label' });
let label = new St.Label({ text: DisplayStrings.getPixels(target[targetProperty]), style_class: 'draw-on-your-screen-menu-slider-label' });
let slider = new Slider.Slider(target[targetProperty] / 50);
if (GS_VERSION < '3.33.0') {
slider.connect('value-changed', (slider, value, property) => {
target[targetProperty] = Math.max(Math.round(value * 50), 0);
label.set_text(target[targetProperty] + " px");
label.set_text(DisplayStrings.getPixels(target[targetProperty]));
if (target[targetProperty] === 0)
label.add_style_class_name(Extension.WARNING_COLOR_STYLE_CLASS_NAME);
label.add_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME);
else
label.remove_style_class_name(Extension.WARNING_COLOR_STYLE_CLASS_NAME);
label.remove_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME);
});
} else {
slider.connect('notify::value', () => {
target[targetProperty] = Math.max(Math.round(slider.value * 50), 0);
label.set_text(target[targetProperty] + " px");
label.set_text(DisplayStrings.getPixels(target[targetProperty]));
if (target[targetProperty] === 0)
label.add_style_class_name(Extension.WARNING_COLOR_STYLE_CLASS_NAME);
label.add_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME);
else
label.remove_style_class_name(Extension.WARNING_COLOR_STYLE_CLASS_NAME);
label.remove_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME);
});
}
@ -327,98 +395,159 @@ var DrawingMenu = new Lang.Class({
menu.addMenuItem(item);
},
_addSubMenuItem: function(menu, icon, obj, target, targetProperty, callback) {
if (targetProperty == 'currentImage')
icon = obj[target[targetProperty]].gicon;
let item = new PopupMenu.PopupSubMenuMenuItem(_(String(obj[target[targetProperty]])), icon ? true : false);
if (icon && icon instanceof GObject.Object && GObject.type_is_a(icon, Gio.Icon))
item.icon.set_gicon(icon);
else if (icon)
item.icon.set_icon_name(icon);
_addSubMenuItem: function(menu, icon, obj, target, targetProperty) {
let item = new PopupMenu.PopupSubMenuMenuItem(String(obj[target[targetProperty]]), icon ? true : false);
item.menu.itemActivated = () => {
item.menu.close();
};
item.icon.set_gicon(icon);
item.menu.itemActivated = item.menu.close;
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
for (let i in obj) {
let text;
if (targetProperty == 'currentFontWeight')
text = `<span font_weight="${i}">${_(obj[i])}</span>`;
else if (targetProperty == 'currentFontStyle')
text = `<span font_style="${obj[i].toLowerCase()}">${_(obj[i])}</span>`;
else
text = _(String(obj[i]));
Object.keys(obj).forEach(key => {
let text = targetProperty == 'currentFontWeight' ? `<span font_weight="${key}">${obj[key]}</span>` :
targetProperty == 'currentFontStyle' ? `<span font_style="${DisplayStrings.FontStyleMarkup[key]}">${obj[key]}</span>` :
String(obj[key]);
let iCaptured = Number(i);
let subItem = item.menu.addAction(text, () => {
item.label.set_text(_(String(obj[iCaptured])));
target[targetProperty] = iCaptured;
if (targetProperty == 'currentImage')
item.icon.set_gicon(obj[iCaptured].gicon);
if (callback)
callback();
item.label.set_text(String(obj[key]));
target[targetProperty] = Number(key);
});
subItem.label.get_clutter_text().set_use_markup(true);
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
});
return GLib.SOURCE_REMOVE;
});
menu.addMenuItem(item);
},
_addToolSubMenuItem: function(menu, callback) {
let item = new PopupMenu.PopupSubMenuMenuItem('', true);
item.update = () => {
item.label.set_text(DisplayStrings.Tool[this.area.currentTool]);
let toolName = this.DrawingTool.getNameOf(this.area.currentTool);
item.icon.set_gicon(Files.Icons[`TOOL_${toolName}`]);
};
item.update();
item.menu.itemActivated = item.menu.close;
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
Object.keys(DisplayStrings.Tool).forEach(key => {
let text = DisplayStrings.Tool[key];
let toolName = this.DrawingTool.getNameOf(key);
let subItemIcon = Files.Icons[`TOOL_${toolName}`];
let subItem = item.menu.addAction(text, () => {
this.area.currentTool = Number(key);
item.update();
callback();
}, subItemIcon);
subItem.label.get_clutter_text().set_use_markup(true);
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
// change the display order of tools
if (obj == Area.ToolNames && i == Area.Tools.POLYGON)
item.menu.moveMenuItem(subItem, 4);
else if (obj == Area.ToolNames && i == Area.Tools.POLYLINE)
item.menu.moveMenuItem(subItem, 5);
}
if (key == this.DrawingTool.POLYGON)
item.menu.moveMenuItem(subItem, Number(this.DrawingTool.TEXT));
else if (key == this.DrawingTool.POLYLINE)
item.menu.moveMenuItem(subItem, Number(this.DrawingTool.TEXT) + 1);
});
return GLib.SOURCE_REMOVE;
});
menu.addMenuItem(item);
},
_addColorSubMenuItem: function(menu) {
let item = new PopupMenu.PopupSubMenuMenuItem(_("Color"), true);
item.icon.set_gicon(this.colorIcon);
item.icon.set_style(`color:${this.area.currentColor.to_string().slice(0, 7)};`);
item.menu.itemActivated = () => {
item.menu.close();
};
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
for (let i = 1; i < this.area.colors.length; i++) {
let text = this.area.colors[i].to_string();
let iCaptured = i;
let colorItem = item.menu.addAction(text, () => {
this.area.currentColor = this.area.colors[iCaptured];
item.icon.set_style(`color:${this.area.currentColor.to_string().slice(0, 7)};`);
});
// Foreground color markup is not displayed since 3.36, use style instead but the transparency is lost.
colorItem.label.set_style(`color:${this.area.colors[i].to_string().slice(0, 7)};`);
getActor(colorItem).connect('key-focus-in', updateSubMenuAdjustment);
}
return GLib.SOURCE_REMOVE;
});
menu.addMenuItem(item);
return item;
},
_addFontFamilySubMenuItem: function(menu, icon) {
let item = new PopupMenu.PopupSubMenuMenuItem(this.area.currentFontFamily, true);
item.icon.set_icon_name(icon);
_addPaletteSubMenuItem: function(menu, icon) {
let text = _(this.area.currentPalette[0] || "Palette");
let item = new PopupMenu.PopupSubMenuMenuItem(text, true);
item.icon.set_gicon(icon);
item.menu.itemActivated = () => {
item.menu.close();
item.menu.itemActivated = item.menu.close;
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this.area.palettes.forEach(palette => {
let [name, colors] = palette;
if (!colors[0])
return;
let subItem = item.menu.addAction(_(name || "Palette"), () => {
item.label.set_text(_(name || "Palette"));
this.area.currentPalette = palette;
this._populateColorSubMenu();
});
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
});
return GLib.SOURCE_REMOVE;
});
menu.addMenuItem(item);
return item;
},
_addColorSubMenuItem: function(menu, icon) {
let item = new PopupMenu.PopupSubMenuMenuItem(_("Color"), true);
this.colorSubMenu = item.menu;
item.icon.set_gicon(icon);
item.icon.set_style(`color:${this.area.currentColor.to_string().slice(0, 7)};`);
if (GS_VERSION >= '3.30') {
let colorPickerCallback = () => {
this.close();
this.area.pickColor();
};
// Translators: It is displayed in a menu button tooltip or as a shortcut action description, so it should NOT use the imperative mood.
let colorPickerButton = new ActionButton(_("Pick a color"), Files.Icons.COLOR_PICKER, colorPickerCallback, null, true);
let index = getActor(item).get_children().length - 1;
getActor(item).insert_child_at_index(colorPickerButton, index);
}
item.menu.itemActivated = item.menu.close;
this._populateColorSubMenu();
menu.addMenuItem(item);
return item;
},
_populateColorSubMenu: function() {
this.colorSubMenu.removeAll();
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this.area.colors.forEach(color => {
let text = String(color);
let subItem = this.colorSubMenu.addAction(text, () => {
this.area.currentColor = color;
this.colorItem.icon.set_style(`color:${color.to_string().slice(0, 7)};`);
});
// Foreground color markup is not displayed since 3.36, use style instead but the transparency is lost.
subItem.label.set_style(`color:${color.to_string().slice(0, 7)};`);
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
});
return GLib.SOURCE_REMOVE;
});
},
_addFontFamilySubMenuItem: function(menu, icon) {
let item = new PopupMenu.PopupSubMenuMenuItem(DisplayStrings.getFontFamily(this.area.currentFontFamily), true);
item.icon.set_gicon(icon);
item.menu.itemActivated = item.menu.close;
item.menu.actor.add_style_class_name('draw-on-your-screen-menu-ellipsized');
item.menu.openOld = item.menu.open;
item.menu.open = (animate) => {
if (!item.menu.isOpen && item.menu.isEmpty()) {
this.area.fontFamilies.forEach(family => {
let subItem = item.menu.addAction(_(family), () => {
item.label.set_text(_(family));
let subItem = item.menu.addAction(DisplayStrings.getFontFamily(family), () => {
item.label.set_text(DisplayStrings.getFontFamily(family));
this.area.currentFontFamily = family;
});
if (FONT_FAMILY_STYLE)
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
subItem.label.set_style(`font-family:${family}`);
});
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
});
}
@ -428,32 +557,89 @@ var DrawingMenu = new Lang.Class({
menu.addMenuItem(item);
},
_addTextAlignmentSubMenuItem: function(menu) {
let item = new PopupMenu.PopupSubMenuMenuItem(DisplayStrings.TextAlignment[this.area.currentTextAlignment], true);
item.icon.set_gicon(TextAlignmentIcon[this.area.currentTextAlignment]);
item.menu.itemActivated = item.menu.close;
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
Object.keys(TextAlignmentIcon).forEach(key => {
let subItem = item.menu.addAction(DisplayStrings.TextAlignment[key], () => {
item.label.set_text(DisplayStrings.TextAlignment[key]);
this.area.currentTextAlignment = key;
item.icon.set_gicon(TextAlignmentIcon[key]);
});
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
});
return GLib.SOURCE_REMOVE;
});
menu.addMenuItem(item);
},
_addImageSubMenuItem: function(menu, images) {
let item = new PopupMenu.PopupSubMenuMenuItem('', true);
item.update = () => {
item.label.set_text(this.area.currentImage.toString());
item.icon.set_gicon(this.area.currentImage.gicon);
};
item.update();
item.menu.itemActivated = item.menu.close;
item.menu.actor.add_style_class_name('draw-on-your-screen-menu-ellipsized');
item.menu.openOld = item.menu.open;
item.menu.open = (animate) => {
if (!item.menu.isOpen && item.menu.isEmpty()) {
Files.Images.getSorted().forEach(image => {
let subItem = item.menu.addAction(image.toString(), () => {
this.area.currentImage = image;
item.update();
}, Files.Icons.FAKE);
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
if (subItem.setIcon && image.thumbnailGicon)
subItem.setIcon(image.thumbnailGicon);
});
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
});
}
item.menu.openOld();
};
menu.addMenuItem(item);
return item;
},
_addDrawingNameItem: function(menu) {
this.drawingNameMenuItem = new PopupMenu.PopupMenuItem('', { reactive: false, activate: false });
this.drawingNameMenuItem.setSensitive(false);
getActor(this.drawingNameMenuItem).add_style_class_name('draw-on-your-screen-menu-ellipsized');
menu.addMenuItem(this.drawingNameMenuItem);
this._updateDrawingNameMenuItem();
},
_updateDrawingNameMenuItem: function() {
getActor(this.drawingNameMenuItem).visible = this.area.jsonName ? true : false;
if (this.area.jsonName) {
getActor(this.drawingNameMenuItem).visible = this.area.currentJson ? true : false;
if (this.area.currentJson) {
let prefix = this.area.drawingContentsHasChanged ? "* " : "";
this.drawingNameMenuItem.label.set_text(`<i>${prefix}${this.area.jsonName}</i>`);
this.drawingNameMenuItem.label.set_text(`<i>${prefix}${this.area.currentJson.name}</i>`);
this.drawingNameMenuItem.label.get_clutter_text().set_use_markup(true);
}
},
_addOpenDrawingSubMenuItem: function(menu) {
let item = new PopupMenu.PopupSubMenuMenuItem(_("Open drawing"), true);
_addOpenDrawingSubMenuItem: function(menu, label, icon) {
let item = new PopupMenu.PopupSubMenuMenuItem(label, true);
this.openDrawingSubMenuItem = item;
this.openDrawingSubMenu = item.menu;
item.setSensitive(Boolean(Files.getJsons().length));
item.icon.set_icon_name('document-open-symbolic');
item.setSensitive(Boolean(Files.Jsons.getSorted().length));
item.icon.set_icon_name(icon);
item.menu.itemActivated = () => {
item.menu.close();
};
item.menu.itemActivated = item.menu.close;
item.menu.actor.add_style_class_name('draw-on-your-screen-menu-ellipsized');
item.menu.openOld = item.menu.open;
item.menu.open = (animate) => {
@ -467,13 +653,21 @@ var DrawingMenu = new Lang.Class({
_populateOpenDrawingSubMenu: function() {
this.openDrawingSubMenu.removeAll();
let jsons = Files.getJsons();
jsons.forEach(json => {
Files.Jsons.getSorted().forEach(json => {
if (!json.gicon)
json.addSvgContents(...this.area.getSvgContentsForJson(json));
let subItem = this.openDrawingSubMenu.addAction(`<i>${String(json)}</i>`, () => {
this.area.loadJson(json.name);
this.area.loadJson(json);
this._updateDrawingNameMenuItem();
this._updateSaveDrawingSubMenuItemSensitivity();
this._updateActionSensitivity();
}, Files.Icons.FAKE);
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
if (subItem.setIcon)
subItem.setIcon(json.gicon);
});
subItem.label.get_clutter_text().set_use_markup(true);
getActor(subItem).connect('key-focus-in', updateSubMenuAdjustment);
@ -483,32 +677,36 @@ var DrawingMenu = new Lang.Class({
});
getActor(subItem).add_child(expander);
let deleteButton = new St.Button({ style_class: 'draw-on-your-screen-menu-delete-button',
child: new St.Icon({ icon_name: 'edit-delete-symbolic',
style_class: 'popup-menu-icon',
x_align: Clutter.ActorAlign.END }) });
getActor(subItem).add_child(deleteButton);
let insertCallback = () => {
this.area.currentImage = json.image;
this.imageItem.update();
this.area.currentTool = this.DrawingTool.IMAGE;
this.toolItem.update();
this._updateSectionVisibility();
};
let insertButton = new ActionButton(_("Add to images"), 'insert-image-symbolic', insertCallback, null, true);
getActor(subItem).add_child(insertButton);
deleteButton.connect('clicked', () => {
let deleteCallback = () => {
json.delete();
subItem.destroy();
this.openDrawingSubMenuItem.setSensitive(!this.openDrawingSubMenu.isEmpty());
});
};
let deleteButton = new ActionButton(_("Delete"), 'edit-delete-symbolic', deleteCallback, null, true);
deleteButton.child.add_style_class_name('draw-on-your-screen-menu-destructive-button');
getActor(subItem).add_child(deleteButton);
});
this.openDrawingSubMenuItem.setSensitive(!this.openDrawingSubMenu.isEmpty());
},
_addSaveDrawingSubMenuItem: function(menu) {
let item = new PopupMenu.PopupSubMenuMenuItem(_("Save drawing"), true);
_addSaveDrawingSubMenuItem: function(menu, label, icon) {
let item = new PopupMenu.PopupSubMenuMenuItem(label, true);
this.saveDrawingSubMenuItem = item;
this._updateSaveDrawingSubMenuItemSensitivity();
this.saveDrawingSubMenu = item.menu;
item.icon.set_icon_name('document-save-symbolic');
item.icon.set_icon_name(icon);
item.menu.itemActivated = () => {
item.menu.close();
};
item.menu.itemActivated = item.menu.close;
item.menu.openOld = item.menu.open;
item.menu.open = (animate) => {
@ -530,7 +728,8 @@ var DrawingMenu = new Lang.Class({
_populateSaveDrawingSubMenu: function() {
this.saveDrawingSubMenu.removeAll();
let saveEntry = new DrawingMenuEntry({ initialTextGetter: Files.getDateString,
let saveEntry = new Entry({ initialTextGetter: () => this.area.currentJson ? this.area.currentJson.name : "",
hint_text: _("Type a name"),
entryActivateCallback: (text) => {
this.area.saveAsJsonWithName(text, this._onDrawingSaved.bind(this));
this.saveDrawingSubMenu.toggle();
@ -568,9 +767,54 @@ const updateSubMenuAdjustment = function(itemActor) {
adjustment.set_value(newScrollValue);
};
// An action button that uses upstream dash item tooltips.
const ActionButton = new Lang.Class({
Name: `${UUID}-DrawingMenuActionButton`,
Extends: St.Bin,
_labelShowing: false,
_resetHoverTimeoutId: 0,
_showLabelTimeoutId: 0,
showLabel: Dash.DashItemContainer.prototype.showLabel,
hideLabel: Dash.DashItemContainer.prototype.hideLabel,
_syncLabel: Dash.Dash.prototype._syncLabel,
_init: function(name, icon, callback, callbackAfter, inline) {
this._labelText = name;
let button = new St.Button({ track_hover: true,
x_align: Clutter.ActorAlign.CENTER,
accessible_name: name,
style_class: `button draw-on-your-screen-menu-${inline ? 'inline' : 'action'}-button` });
button.child = new St.Icon(typeof icon == 'string' ? { icon_name: icon } : { gicon: icon });
if (inline)
button.child.add_style_class_name('popup-menu-icon');
button.connect('clicked', () => {
callback();
if (callbackAfter)
callbackAfter();
});
button.bind_property('reactive', button, 'can_focus', GObject.BindingFlags.DEFAULT);
button.connect('notify::hover', () => this._syncLabel(this));
this.parent({ child: button, x_expand: inline ? false : true });
},
get label() {
if (!this._label) {
this._label = new St.Label({ style_class: 'dash-label' });
Main.layoutManager.uiGroup.add_actor(this._label);
this.connect('destroy', () => this._label.destroy());
}
return this._label;
}
});
// based on searchItem.js, https://github.com/leonardo-bartoli/gnome-shell-extension-Recents
const DrawingMenuEntry = new Lang.Class({
Name: 'DrawOnYourScreenDrawingMenuEntry',
const Entry = new Lang.Class({
Name: `${UUID}-DrawingMenuEntry`,
_init: function(params) {
this.params = params;
@ -582,6 +826,7 @@ const DrawingMenuEntry = new Lang.Class({
this.itemActor = GS_VERSION < '3.33.0' ? this.item.actor : this.item;
this.entry = new St.Entry({
hint_text: params.hint_text || "",
style_class: 'search-entry draw-on-your-screen-menu-entry',
track_hover: true,
reactive: true,

View File

@ -1,11 +1,11 @@
{
"name": "Draw On You Screen",
"description": "Start drawing with Super+Alt+D and save your beautiful work by taking a screenshot",
"uuid": "drawOnYourScreen@abakkk.framagit.org",
"url": "https://framagit.org/abakkk/DrawOnYourScreen",
"uuid": "draw-on-your-screen@som.codeberg.org",
"url": "https://codeberg.org/som/DrawOnYourScreen",
"settings-schema": "org.gnome.shell.extensions.draw-on-your-screen",
"gettext-domain": "draw-on-your-screen",
"data-dir": "drawOnYourScreen",
"data-dir": "draw-on-your-screen",
"persistent-file-name": "persistent",
"svg-file-name": "DrawOnYourScreen",
"shell-version": [
@ -15,7 +15,9 @@
"3.30",
"3.32",
"3.34",
"3.36"
"3.36",
"3.38",
"40"
],
"version": 6.2
"version": 11.1
}

950
prefs.js

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,290 +1,346 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gnome-shell-extensions">
<schemalist gettext-domain="draw-on-your-screen">
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/" id="org.gnome.shell.extensions.draw-on-your-screen">
<child name="drawing" schema="org.gnome.shell.extensions.draw-on-your-screen.drawing"/>
<child name="internal-shortcuts" schema="org.gnome.shell.extensions.draw-on-your-screen.internal-shortcuts"/>
<key type="b" name="drawing-on-desktop">
<default>false</default>
<summary>move drawing on desktop</summary>
<description>move drawing on desktop</description>
<summary>Drawing on the desktop</summary>
<description><![CDATA[<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>]]></description>
</key>
<key type="b" name="persistent-drawing">
<default>false</default>
<summary>persistent drawing</summary>
<description>persistent drawing</description>
</key>
<key type="b" name="osd-disabled">
<default>false</default>
<summary>disable OSD notifications</summary>
<description>disable on-screen notifications</description>
<key type="as" name="erase-drawings">
<default>["&lt;Alt&gt;&lt;Super&gt;e"]</default>
<summary>Erase all drawings</summary>
</key>
<key type="b" name="indicator-disabled">
<default>false</default>
<summary>disable panel indicator</summary>
<description>disable panel indicator</description>
<summary>Disable panel indicator</summary>
</key>
<key type="b" name="osd-disabled">
<default>false</default>
<summary>Disable on-screen notifications</summary>
</key>
<key type="b" name="persistent-over-toggles">
<default>true</default>
<summary>Persistent over toggles</summary>
<description>Drawing remains when toggling drawing mode</description>
</key>
<key type="b" name="persistent-over-restarts">
<default>false</default>
<summary>Persistent over restarts</summary>
<description>Drawing is automatically saved to a file</description>
</key>
<key type="as" name="toggle-drawing">
<default>["&lt;Alt&gt;&lt;Super&gt;d"]</default>
<summary>toggle drawing</summary>
<description>enter or leave drawing mode</description>
<summary>Enter/leave drawing mode</summary>
</key>
<key type="as" name="toggle-modal">
<default>["&lt;Primary&gt;&lt;Alt&gt;&lt;Super&gt;d"]</default>
<summary>toggle modeless/modal</summary>
<description>toggle modeless/modal</description>
<!-- Translators: there is a similar text in GNOME Boxes (https://gitlab.gnome.org/GNOME/gnome-boxes/tree/master/po) -->
<summary>Grab/ungrab keyboard and pointer</summary>
<description></description>
</key>
<key type="as" name="erase-drawing">
<default>["&lt;Alt&gt;&lt;Super&gt;e"]</default>
<summary>erase drawing</summary>
<description>erase drawing</description>
</schema>
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/drawing/" id="org.gnome.shell.extensions.draw-on-your-screen.drawing">
<key type="s" name="background-color">
<default>"#2e2e2e"</default>
<summary>Background color</summary>
<description>The color of the drawing area background</description>
</key>
<key type="as" name="undo">
<default>["&lt;Primary&gt;z"]</default>
<summary>undo</summary>
<description>undo</description>
<key type="b" name="dash-array-auto">
<default>true</default>
<summary>Automatic dash array</summary>
<description>Compute the lengths from the line width</description>
</key>
<key type="as" name="redo">
<default>["&lt;Primary&gt;&lt;Shift&gt;z"]</default>
<summary>redo</summary>
<description>redo</description>
<key type="d" name="dash-array-on">
<range min="0.1" max="16384"/>
<default>5</default>
<summary>Dash array on</summary>
<description>The dash length in pixels</description>
</key>
<key type="as" name="delete-last-element">
<default>["Delete"]</default>
<summary>delete last element</summary>
<description>delete last element</description>
<key type="d" name="dash-array-off">
<range min="0.1" max="16384"/>
<default>15</default>
<summary>Dash array off</summary>
<description>The gap between the dashes in pixels</description>
</key>
<key type="as" name="smooth-last-element">
<default>["&lt;Primary&gt;equal"]</default>
<summary>smooth last brushstroke</summary>
<description>smooth last brushstroke</description>
<key type="d" name="dash-offset">
<range min="-16384" max="16384"/>
<default>0</default>
<summary>Dash offset</summary>
<description>The dash offset in pixels</description>
</key>
<key type="as" name="toggle-background">
<default>["&lt;Primary&gt;b"]</default>
<summary>toggle drawing background</summary>
<description>toggle drawing background</description>
<key type="s" name="grid-color">
<default>"Gray"</default>
<summary>Grid overlay color</summary>
<description>The color of the lines</description>
</key>
<key type="as" name="toggle-grid">
<default>["&lt;Primary&gt;g"]</default>
<summary>toggle grid overlay</summary>
<description>toggle grid overlay</description>
<key type="b" name="grid-line-auto">
<default>true</default>
<summary>Automatic grid overlay line</summary>
<description>Compute the lengths from the screen size</description>
</key>
<key type="as" name="toggle-panel-and-dock-visibility">
<default>["&lt;Primary&gt;h"]</default>
<summary>hide or show panel and dock</summary>
<description>hide or show panel and dock</description>
<key type="u" name="grid-line-spacing">
<range min="1" max="16384"/>
<default>10</default>
<summary>Grid overlay line spacing</summary>
<description>The gap between lines in pixels</description>
</key>
<key type="as" name="toggle-square-area">
<default>["&lt;Primary&gt;n"]</default>
<summary>toggle square area</summary>
<description>toggle square area</description>
<key type="d" name="grid-line-width">
<range min="0.1" max="10"/>
<default>0.5</default>
<summary>Grid overlay line width</summary>
<description>The line width in pixels</description>
</key>
<key type="as" name="select-ellipse-shape">
<default>["&lt;Primary&gt;e"]</default>
<summary>select cercle</summary>
<description>select a cercle</description>
<key type="s" name="image-location">
<default>""</default>
<summary>Image location</summary>
<description>The location of the directory in which the image tool picks</description>
</key>
<key type="as" name="select-rectangle-shape">
<default>["&lt;Primary&gt;r"]</default>
<summary>select rectangle</summary>
<description>select rectangle</description>
<key type="a(sas)" name="palettes">
<default>
[
('Palette', ['HotPink', 'Cyan', 'yellow', 'Orangered', 'Chartreuse', 'DarkViolet', 'White', 'Gray', 'Black']),
('GNOME HIG lighter', ['rgb(153,193,241):Blue 1', 'rgb(143,240,164):Green 1', 'rgb(249,240,107):Yellow 1', 'rgb(255,190,111):Orange 1', 'rgb(246,97,81):Red 1', 'rgb(220,138,221):Purple 1', 'rgb(205,171,143):Brown 1', 'rgb(255,255,255):Light 1', 'rgb(119,118,123):Dark 1']),
('GNOME HIG light', ['rgb(98,160,234):Blue 2', 'rgb(87,227,137):Green 2', 'rgb(248,228,92):Yellow 2', 'rgb(255,163,72):Orange 2', 'rgb(237,51,59):Red 2', 'rgb(192,97,203):Purple 2', 'rgb(181,131,90):Brown 2', 'rgb(246,245,244):Light 2', 'rgb(94,92,100):Dark 2']),
('GNOME HIG normal', ['rgb(53,132,228):Blue 3', 'rgb(51,209,122):Green 3', 'rgb(246,211,45):Yellow 3', 'rgb(255,120,0):Orange 3', 'rgb(224,27,36):Red 3', 'rgb(145,65,172):Purple 3', 'rgb(152,106,68):Brown 3', 'rgb(222,221,218):Light 3', 'rgb(61,56,70):Dark 3']),
('GNOME HIG dark', ['rgb(28,113,216):Blue 4', 'rgb(46,194,126):Green 4', 'rgb(245,194,17):Yellow 4', 'rgb(230,97,0):Orange 4', 'rgb(192,28,40):Red 4', 'rgb(129,61,156):Purple 4', 'rgb(134,94,60):Brown 4', 'rgb(192,191,188):Light 4', 'rgb(36,31,49):Dark 4']),
('GNOME HIG darker', ['rgb(26,95,180):Blue 5', 'rgb(38,162,105):Green 5', 'rgb(229,165,10):Yellow 5', 'rgb(198,70,0):Orange 5', 'rgb(165,29,45):Red 5', 'rgb(97,53,131):Purple 5', 'rgb(99,69,44):Brown 5', 'rgb(154,153,150):Light 5', 'rgb(0,0,0):Dark 5'])
]
</default>
<summary>Color palettes</summary>
<description>The palettes of drawing colors</description>
</key>
<key type="as" name="select-polygon-shape">
<default>["&lt;Primary&gt;y"]</default>
<summary>select polygon</summary>
<description>select polygon</description>
<key type="b" name="square-area-auto">
<default>true</default>
<summary>Automatic square area size</summary>
<description>Compute the area size from the screen size</description>
</key>
<key type="as" name="select-polyline-shape">
<default>["&lt;Primary&gt;u"]</default>
<summary>select polyline</summary>
<description>select polyline</description>
</key>
<key type="as" name="select-line-shape">
<default>["&lt;Primary&gt;l"]</default>
<summary>select line</summary>
<description>select a line</description>
</key>
<key type="as" name="select-text-shape">
<default>["&lt;Primary&gt;t"]</default>
<summary>select text</summary>
<description>select text</description>
</key>
<key type="as" name="select-image-shape">
<default>["&lt;Primary&gt;i"]</default>
<summary>select image</summary>
<description>select image</description>
</key>
<key type="as" name="select-none-shape">
<default>["&lt;Primary&gt;p"]</default>
<summary>unselect shape (free drawing)</summary>
<description>unselect shape (free drawing)</description>
</key>
<key type="as" name="select-move-tool">
<default>["&lt;Primary&gt;m"]</default>
<summary>select move tool</summary>
<description>select move tool</description>
</key>
<key type="as" name="select-resize-tool">
<default>["&lt;Primary&gt;x"]</default>
<summary>select resize tool</summary>
<description>select resize tool</description>
</key>
<key type="as" name="select-mirror-tool">
<default>["&lt;Primary&gt;c"]</default>
<summary>select mirror tool</summary>
<description>select mirror tool</description>
</key>
<key type="as" name="increment-line-width">
<default><![CDATA[['<Primary>KP_Add','<Primary><Shift>plus']]]></default>
<summary>increment the line width</summary>
<description>increment the line width</description>
<key type="u" name="square-area-size">
<range min="64" max="32768"/>
<default>512</default>
<summary>Square area size</summary>
<description>The size of the area in pixels</description>
</key>
</schema>
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/internal-shortcuts/" id="org.gnome.shell.extensions.draw-on-your-screen.internal-shortcuts">
<key type="as" name="decrement-line-width">
<default><![CDATA[['<Primary>KP_Subtract','<Primary>minus','<Primary><Shift>minus']]]></default>
<summary>decrement the line width</summary>
<description>decrement the line width</description>
</key>
<key type="as" name="increment-line-width-more">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Add"]</default>
<summary>increment the line width even more</summary>
<description>increment the line width even more</description>
<summary>Decrement line width</summary>
</key>
<key type="as" name="decrement-line-width-more">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Subtract"]</default>
<summary>decrement the line width even more</summary>
<description>decrement the line width even more</description>
<summary>Decrement line width even more</summary>
</key>
<key type="as" name="switch-linejoin">
<default>["&lt;Primary&gt;j"]</default>
<summary>switch linejoin</summary>
<description>switch linejoin</description>
<key type="as" name="delete-last-element">
<default>["Delete"]</default>
<summary>Erase last brushstroke</summary>
</key>
<key type="as" name="switch-linecap">
<default>["&lt;Primary&gt;k"]</default>
<summary>switch linecap</summary>
<description>switch linecap</description>
<key type="as" name="export-to-svg">
<default>["&lt;Primary&gt;&lt;Alt&gt;s"]</default>
<summary>Export drawing to a SVG file</summary>
</key>
<key type="as" name="switch-fill-rule">
<default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default>
<summary>switch fill rule</summary>
<description>switch fill rule</description>
<key type="as" name="increment-line-width">
<default><![CDATA[['<Primary>KP_Add','<Primary><Shift>plus']]]></default>
<summary>Increment line width</summary>
</key>
<key type="as" name="switch-dash">
<default>["&lt;Primary&gt;period"]</default>
<summary>switch dash</summary>
<description>switch dash</description>
</key>
<key type="as" name="switch-fill">
<default>["&lt;Primary&gt;a"]</default>
<summary>switch fill</summary>
<description>switch fill</description>
</key>
<key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
<summary>select color1</summary>
<description>select color1</description>
</key>
<key type="as" name="select-color2">
<default><![CDATA[['<Primary>KP_2','<Primary>2']]]></default>
<summary>select color2</summary>
<description>select color2</description>
</key>
<key type="as" name="select-color3">
<default><![CDATA[['<Primary>KP_3','<Primary>3']]]></default>
<summary>select color3</summary>
<description>select color3</description>
</key>
<key type="as" name="select-color4">
<default><![CDATA[['<Primary>KP_4','<Primary>4']]]></default>
<summary>select color4</summary>
<description>select color4</description>
</key>
<key type="as" name="select-color5">
<default><![CDATA[['<Primary>KP_5','<Primary>5']]]></default>
<summary>select color5</summary>
<description>select color5</description>
</key>
<key type="as" name="select-color6">
<default><![CDATA[['<Primary>KP_6','<Primary>6']]]></default>
<summary>select color6</summary>
<description>select color6</description>
</key>
<key type="as" name="select-color7">
<default><![CDATA[['<Primary>KP_7','<Primary>7']]]></default>
<summary>select color7</summary>
<description>select color7</description>
</key>
<key type="as" name="select-color8">
<default><![CDATA[['<Primary>KP_8','<Primary>8']]]></default>
<summary>select color8</summary>
<description>select color8</description>
</key>
<key type="as" name="select-color9">
<default><![CDATA[['<Primary>KP_9','<Primary>9']]]></default>
<summary>select color9</summary>
<description>select color9</description>
</key>
<key type="as" name="switch-font-family">
<default>["&lt;Primary&gt;f"]</default>
<summary>switch font family</summary>
<description>switch font family</description>
</key>
<key type="as" name="reverse-switch-font-family">
<default>["&lt;Primary&gt;&lt;Shift&gt;f"]</default>
<summary>switch font family (reverse)</summary>
<description>switch font family (reverse)</description>
</key>
<key type="as" name="switch-font-weight">
<default>["&lt;Primary&gt;w"]</default>
<summary>switch font weight</summary>
<description>switch font weight</description>
</key>
<key type="as" name="switch-font-style">
<default>["&lt;Primary&gt;&lt;Shift&gt;w"]</default>
<summary>switch font style</summary>
<description>switch font style</description>
</key>
<key type="as" name="switch-text-alignment">
<default>["&lt;Primary&gt;&lt;Shift&gt;a"]</default>
<summary>switch text alignment</summary>
<description>switch text alignment</description>
</key>
<key type="as" name="switch-image-file">
<default>["&lt;Primary&gt;&lt;Shift&gt;i"]</default>
<summary>switch image file</summary>
<description>switch image file</description>
</key>
<key type="as" name="open-user-stylesheet">
<default>["&lt;Primary&gt;o"]</default>
<summary>open user stylesheet to edit style</summary>
<description>open user stylesheet to edit style</description>
</key>
<key type="as" name="save-as-svg">
<default>["&lt;Primary&gt;&lt;Shift&gt;s"]</default>
<summary>Save drawing as a svg file</summary>
<description>Save drawing as a svg file</description>
</key>
<key type="as" name="save-as-json">
<default>["&lt;Primary&gt;s"]</default>
<summary>Save drawing as a json file</summary>
<description>Save drawing as a json file</description>
</key>
<key type="as" name="open-previous-json">
<default>["&lt;Primary&gt;Page_Down"]</default>
<summary>Open previous json file</summary>
<description>Open previous json file</description>
<key type="as" name="increment-line-width-more">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Add"]</default>
<summary>Increment line width even more</summary>
</key>
<key type="as" name="open-next-json">
<default>["&lt;Primary&gt;Page_Up"]</default>
<summary>Open next json file</summary>
<description>Open next json file</description>
<default>["&lt;Primary&gt;o"]</default>
<summary>Open next drawing</summary>
</key>
<key type="as" name="open-preferences">
<default>["&lt;Primary&gt;comma"]</default>
<summary>Open preferences</summary>
<description>Open preferences</description>
</key>
<key type="as" name="open-previous-json">
<default>["&lt;Primary&gt;&lt;Shift&gt;o"]</default>
<summary>Open previous drawing</summary>
</key>
<key type="as" name="paste-image-files">
<default>["&lt;Primary&gt;v"]</default>
<summary>Add images from the clipboard</summary>
</key>
<key type="as" name="pick-color">
<default><![CDATA[['<Primary>KP_0','<Primary>0']]]></default>
<summary>Pick a color</summary>
</key>
<key type="as" name="redo">
<default>["&lt;Primary&gt;&lt;Shift&gt;z"]</default>
<summary>Redo</summary>
</key>
<key type="as" name="save-as-json">
<default>["&lt;Primary&gt;s"]</default>
<summary>Save drawing</summary>
</key>
<key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
<summary>Select color 1</summary>
<description></description>
</key>
<key type="as" name="select-color2">
<default><![CDATA[['<Primary>KP_2','<Primary>2']]]></default>
<summary>Select color 2</summary>
</key>
<key type="as" name="select-color3">
<default><![CDATA[['<Primary>KP_3','<Primary>3']]]></default>
<summary>Select color 3</summary>
</key>
<key type="as" name="select-color4">
<default><![CDATA[['<Primary>KP_4','<Primary>4']]]></default>
<summary>Select color 4</summary>
</key>
<key type="as" name="select-color5">
<default><![CDATA[['<Primary>KP_5','<Primary>5']]]></default>
<summary>Select color 5</summary>
</key>
<key type="as" name="select-color6">
<default><![CDATA[['<Primary>KP_6','<Primary>6']]]></default>
<summary>Select color 6</summary>
</key>
<key type="as" name="select-color7">
<default><![CDATA[['<Primary>KP_7','<Primary>7']]]></default>
<summary>Select color 7</summary>
</key>
<key type="as" name="select-color8">
<default><![CDATA[['<Primary>KP_8','<Primary>8']]]></default>
<summary>Select color 8</summary>
</key>
<key type="as" name="select-color9">
<default><![CDATA[['<Primary>KP_9','<Primary>9']]]></default>
<summary>Select color 9</summary>
</key>
<key type="as" name="select-ellipse-shape">
<default>["&lt;Primary&gt;e"]</default>
<summary>Select ellipse tool</summary>
</key>
<key type="as" name="select-image-shape">
<default>["&lt;Primary&gt;i"]</default>
<summary>Select image tool</summary>
</key>
<key type="as" name="select-line-shape">
<default>["&lt;Primary&gt;l"]</default>
<summary>Select line tool</summary>
</key>
<key type="as" name="select-mirror-tool">
<default>["&lt;Primary&gt;c"]</default>
<summary>Select mirror tool</summary>
</key>
<key type="as" name="select-move-tool">
<default>["&lt;Primary&gt;m"]</default>
<summary>Select move tool</summary>
</key>
<key type="as" name="select-none-shape">
<default>["&lt;Primary&gt;p"]</default>
<summary>Select free drawing</summary>
</key>
<key type="as" name="select-polygon-shape">
<default>["&lt;Primary&gt;y"]</default>
<summary>Select polygon tool</summary>
</key>
<key type="as" name="select-polyline-shape">
<default>["&lt;Primary&gt;u"]</default>
<summary>Select polyline tool</summary>
</key>
<key type="as" name="select-rectangle-shape">
<default>["&lt;Primary&gt;r"]</default>
<summary>Select rectangle tool</summary>
</key>
<key type="as" name="select-resize-tool">
<default>["&lt;Primary&gt;x"]</default>
<summary>Select resize tool</summary>
</key>
<key type="as" name="select-text-shape">
<default>["&lt;Primary&gt;t"]</default>
<summary>Select text tool</summary>
</key>
<key type="as" name="smooth-last-element">
<default>["&lt;Primary&gt;equal"]</default>
<summary>Smooth last brushstroke</summary>
</key>
<key type="as" name="switch-color-palette">
<default>["&lt;Primary&gt;KP_Divide","&lt;Primary&gt;slash"]</default>
<summary>Change color palette</summary>
</key>
<key type="as" name="switch-color-palette-reverse">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Divide","&lt;Primary&gt;&lt;Shift&gt;slash"]</default>
<summary>Change color palette (reverse)</summary>
</key>
<key type="as" name="switch-dash">
<default>["&lt;Primary&gt;period"]</default>
<summary>Dashed line</summary>
</key>
<key type="as" name="switch-fill">
<default>["&lt;Primary&gt;a"]</default>
<summary>Toggle fill/outline</summary>
</key>
<key type="as" name="switch-fill-rule">
<default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default>
<summary>Toggle fill rule</summary>
</key>
<key type="as" name="switch-font-family">
<default>["&lt;Primary&gt;f"]</default>
<summary>Change font family</summary>
</key>
<key type="as" name="switch-font-family-reverse">
<default>["&lt;Primary&gt;&lt;Shift&gt;f"]</default>
<summary>Change font family (reverse)</summary>
</key>
<key type="as" name="switch-font-style">
<default>["&lt;Primary&gt;&lt;Alt&gt;w"]</default>
<summary>Change font style</summary>
</key>
<key type="as" name="switch-font-weight">
<default>["&lt;Primary&gt;w"]</default>
<summary>Change font weight</summary>
</key>
<key type="as" name="switch-image-file">
<default>["&lt;Primary&gt;&lt;Alt&gt;i"]</default>
<summary>Change image</summary>
</key>
<key type="as" name="switch-image-file-reverse">
<default>["&lt;Primary&gt;&lt;Alt&gt;&lt;Shift&gt;i"]</default>
<summary>Change image (reverse)</summary>
</key>
<key type="as" name="switch-linecap">
<default>["&lt;Primary&gt;k"]</default>
<summary>Change linecap</summary>
</key>
<key type="as" name="switch-linejoin">
<default>["&lt;Primary&gt;j"]</default>
<summary>Change linejoin</summary>
</key>
<key type="as" name="switch-text-alignment">
<default>["&lt;Primary&gt;&lt;Alt&gt;a"]</default>
<summary>Change text alignment</summary>
</key>
<key type="as" name="toggle-background">
<default>["&lt;Primary&gt;b"]</default>
<summary>Add a drawing background</summary>
</key>
<key type="as" name="toggle-grid">
<default>["&lt;Primary&gt;g"]</default>
<summary>Add a grid overlay</summary>
</key>
<key type="as" name="toggle-help">
<default>["&lt;Primary&gt;F1"]</default>
<summary>toggle help</summary>
<description>toggle help</description>
<summary>Show help</summary>
</key>
<key type="as" name="toggle-panel-and-dock-visibility">
<default>["&lt;Primary&gt;h"]</default>
<summary>Hide panel and dock</summary>
</key>
<key type="as" name="toggle-square-area">
<default>["&lt;Primary&gt;n"]</default>
<!-- Translators: It is an action: "Make the drawing area a square" -->
<summary>Square drawing area</summary>
</key>
<key type="as" name="undo">
<default>["&lt;Primary&gt;z"]</default>
<summary>Undo</summary>
</key>
</schema>
</schemalist>

118
shortcuts.js Normal file
View File

@ -0,0 +1,118 @@
/*
* Copyright 2019 Abakkk
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-FileCopyrightText: 2019 Abakkk
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/* jslint esversion: 6 */
/* exported GLOBAL_KEYBINDINGS, INTERNAL_KEYBINDINGS, OTHERS */
const Gtk = imports.gi.Gtk;
const IS_GTK3 = Gtk.get_major_version() == 3;
const GS_VERSION = imports.misc.config.PACKAGE_VERSION;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = ExtensionUtils.getSettings && ExtensionUtils.initTranslations ? ExtensionUtils : Me.imports.convenience;
const _ = imports.gettext.domain(Me.metadata['gettext-domain']).gettext;
const internalShortcutsSchema = Convenience.getSettings(Me.metadata['settings-schema'] + '.internal-shortcuts').settings_schema;
const getKeyLabel = function(accel) {
let success_, keyval, mods;
if (IS_GTK3)
[keyval, mods] = Gtk.accelerator_parse(accel);
else
[success_, keyval, mods] = Gtk.accelerator_parse(accel);
return Gtk.accelerator_get_label(keyval, mods);
};
// The setting keys of the "org.gnome.shell.extensions.draw-on-your-screen" schema.
var GLOBAL_KEYBINDINGS = [
['toggle-drawing', 'toggle-modal', 'erase-drawings'],
];
// The setting keys of the "org.gnome.shell.extensions.draw-on-your-screen.internal-shortcuts" schema.
var INTERNAL_KEYBINDINGS = [
['undo', 'redo', 'delete-last-element', 'smooth-last-element'],
['select-none-shape', 'select-line-shape', 'select-ellipse-shape', 'select-rectangle-shape', 'select-polygon-shape', 'select-polyline-shape',
'select-text-shape', 'select-image-shape', 'select-move-tool', 'select-resize-tool', 'select-mirror-tool'],
['switch-fill', 'switch-fill-rule', 'switch-color-palette', 'switch-color-palette-reverse', 'pick-color'],
['increment-line-width', 'increment-line-width-more', 'decrement-line-width', 'decrement-line-width-more',
'switch-linejoin', 'switch-linecap', 'switch-dash'],
['switch-font-family', 'switch-font-family-reverse', 'switch-font-weight', 'switch-font-style', 'switch-text-alignment'],
['switch-image-file', 'switch-image-file-reverse', 'paste-image-files'],
['toggle-panel-and-dock-visibility', 'toggle-background', 'toggle-grid', 'toggle-square-area'],
['open-next-json', 'open-previous-json', 'save-as-json', 'export-to-svg', 'open-preferences', 'toggle-help'],
];
if (GS_VERSION < '3.30') {
// Remove 'pick-color' keybinding.
INTERNAL_KEYBINDINGS.forEach(settingKeys => {
let index = settingKeys.indexOf('pick-color');
if (index != -1)
settingKeys.splice(index, 1);
});
}
if (GS_VERSION < '3.36') {
// Remove 'open-preferences' keybinding.
INTERNAL_KEYBINDINGS.forEach(settingKeys => {
let index = settingKeys.indexOf('open-preferences');
if (index != -1)
settingKeys.splice(index, 1);
});
}
const getOthers = function() {
return [
[
[_("Draw"), _("Left click")],
[_("Menu"), _("Right click")],
[internalShortcutsSchema.get_key('switch-fill').get_summary(), _("Center click")],
[_("Increment/decrement line width"), _("Scroll")],
// Translators: %s are key labels (Ctrl+F1 and Ctrl+F9)
[_("Select color"), _("%s … %s").format(getKeyLabel('<Primary>1'), getKeyLabel('<Primary>9'))],
// Translators: %s is a key label
[_("Ignore pointer movement"), _("%s held").format(getKeyLabel('space'))],
[_("Leave"), getKeyLabel('Escape')],
], [
[_("Select eraser <span alpha=\"50%\">(while starting drawing)</span>"), getKeyLabel('<Shift>')],
[_("Duplicate <span alpha=\"50%\">(while starting handling)</span>"), getKeyLabel('<Shift>')],
[_("Rotate rectangle, polygon, polyline"), getKeyLabel('<Primary>')],
[_("Extend circle to ellipse"), getKeyLabel('<Primary>')],
[_("Curve line"), getKeyLabel('<Primary>')],
[_("Smooth free drawing outline"), getKeyLabel('<Primary>')],
[_("Do not preserve image ratio"), getKeyLabel('<Primary>')],
[_("Rotate <span alpha=\"50%\">(while moving)</span>"), getKeyLabel('<Primary>')],
[_("Stretch <span alpha=\"50%\">(while resizing)</span>"), getKeyLabel('<Primary>')],
[_("Inverse <span alpha=\"50%\">(while mirroring)</span>"), getKeyLabel('<Primary>')],
],
];
};
let _OTHERS;
// Equivalent to "var OTHERS = [[ ... ]]", but as a getter so the translations are got after the initTranslations call.
// 'this' is the module.
Object.defineProperty(this, 'OTHERS', {
get: function() {
if (!_OTHERS)
_OTHERS = getOthers();
return _OTHERS;
}
});

View File

@ -1,14 +1,10 @@
@import "./data/default.css";
/* The following styles don't affect the drawing */
/* square area */
.draw-on-your-screen-square-area {
.draw-on-your-screen .draw-on-your-screen-square-area {
outline: 2px solid rgba(255, 0, 0, 0.7);
}
.draw-on-your-screen-square-area:insensitive {
.draw-on-your-screen:insensitive .draw-on-your-screen-square-area {
outline: none;
}
@ -41,6 +37,7 @@
.draw-on-your-screen-menu {
font-size: 0.97em; /* default: 1em */
min-width: 21em; /* like the aggregate menu */
}
.draw-on-your-screen-menu .popup-menu-item {
@ -48,11 +45,16 @@
padding-bottom: .3em;
}
.draw-on-your-screen-menu .popup-menu-icon {
.draw-on-your-screen-menu .popup-menu-item > .popup-menu-icon {
icon-size: 1em; /* default: 1.09 */
padding-top: 0.03em;
}
/* max size for uncontrolled contents (font, image and drawing names) */
.draw-on-your-screen-menu-ellipsized {
max-width: 21em;
}
.draw-on-your-screen-menu .toggle-switch {
height: 1.35em; /* default: 22px */
}
@ -80,23 +82,20 @@
margin-top: 0;
}
/* system-menu-action: from GS 3.34- */
.draw-on-your-screen-menu .system-menu-action {
.draw-on-your-screen-menu-destructive-button:hover {
color: #e01b24; /* upstream destructive color, light: #e01b24, dark: #b2161d */
}
/* override .button upstream style class */
.draw-on-your-screen-menu-action-button {
min-height: 0;
min-width: 0;
border: none;
border-radius: 32px;
padding: 12px;
margin: 0;
}
.draw-on-your-screen-menu .system-menu-action:hover,
.draw-on-your-screen-menu .system-menu-action:focus {
border: none;
padding: 12px;
}
.draw-on-your-screen-menu .system-menu-action > StIcon {
icon-size: 16px;
.draw-on-your-screen-menu-action-button > StIcon {
icon-size: 1em;
}
.draw-on-your-screen-menu-slider-label {
@ -124,8 +123,13 @@
padding: 0.35em 0.57em;
}
.draw-on-your-screen-menu-delete-button:hover {
color: #f57900;
/* override .button upstream style class */
.draw-on-your-screen-menu-inline-button {
min-height: 1px;
padding: 2px 4px; /* default 3px 24px */
}
.draw-on-your-screen-menu-inline-button .popup-menu-icon {
icon-size: 0.85em; /* default 1.09 */
}