Scribus Plugin: Apply a style
Scribus plugin for applying a style through a small in-place dialog.
This plugin is an alternative to keyboard shortcuts for applying paragraph and character styles.
cltr-shift-space to trigger the "Apply a style" dialog:
Simply type the first letters of the style name and press the
You can also apply character styles:
Take care, that at the time of writing, you should first select some text before being able to apply any charcter formatting.
This plugin is not in Scribus yet: you have to compile Scribus with this plugin if you want to use it.
The dialog is composed by:
- A text box for typing part of the styles name (spaces are ignored)
- A list showing the matching styles:
- the first style in alphabetical order is preselected.
- the currently matching style is marked as bold.
- paragraph styles are prefixed by a ¶, character styles by T.
Tabmoves to the next style in the list
Returnselects the first style in the list.
Esccloses the dialog without applying the style.
- No mouse interaction is possible (the policy will only be reivisde, if somebody can present a valid reason for using the mouse).
- Can be launched through a shortcut and the menues (for discovaribility).
- If scribus is in edit mode, the dialog shows at the cursor position. (The dialog is currently in the middle of the window)
- Otherwise, if a text frame is selected, shows at a yet to be defined position in the visible part of the text frame (or somewhere in the window)
- The list of matching styles should be empty if too many styles are matching.
- Preselect the last style applied?
Shift-Tabshould go backwards in the list.
- Show icons for each type of style.
- Support other types of styles as text styles.
- allow to apply the style to multiple items of the same type.
First make sure that you have the ScribusAPI plugin installed (https://github.com/aoloe/scribus-plugin-API).
scribus-plugin-export-plugin repository and put – or symlink – its
src directory into
applystyle. Then add
CMakeList.txt file in
make your Scribus.
File > Preferences > Keyboard Shortcuts set
Ctrl-Shift-Space for the
Apply a Style command.
Warning: If you're compiler does not default to c++11, you will have to add
-DWANT_CPP11 to your cmake command.
- get the cursor position on the screen
- refresh the rendering of the frame and mark the document as dirty.
- move the
ApplyStyleDialogListItemstruct away from the dialog file.
- Get "h1" to match "Heading 1" and "dp" "Default Paragraph Style" (space is the delimiter, if there is no direct match)
- Add an API function to know the position of the cursor in the frame (not the index, the x, y coordinates)
- Create a dialog that captures the keys but has not input field (if possible).
- Create a dialog that resizes according to the content (upwards or downwards)
- avox says: "if you know the character position, you can use class TextLayout to find the relative position in the frame"
- the code around line 1882 in
pageitem_textframe.cppcould also be interesting
- fuzzy autocomplete: https://github.com/FuzzyAutocomplete/FuzzyAutocompletePlugin
- Maybe create a general runner:
- Only a label, no lineedit
- No mouse support (we might have a second one mouse based)
- Multi stage fast actions (run, rotate, step (1, 10, 15, ...), ← →); with hints on what is available.
- Placed at "standard" places (home, end, page up, page down for edges and center ( (home when already at home moves to the center); next launch at the precedent place.