1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
|
#LyX 1.5.1 created this file. For more info see http://www.lyx.org/
\lyxformat 276
\begin_document
\begin_header
\textclass article
\language english
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\paperfontsize default
\spacing single
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 0
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\author ""
\author ""
\end_header
\begin_body
\begin_layout Standard
\begin_inset LatexCommand tableofcontents
\end_inset
\end_layout
\begin_layout Title
XRCed Manual
\end_layout
\begin_layout Date
Roman Rolinsky <genericsoma@gmail.com>
\end_layout
\begin_layout Section*
Introduction
\end_layout
\begin_layout Standard
XRCed is a resource editor for editing XRC resource files used in wxWidgets
or wxPython.
XRC is an XML-based format for describing the layout of the interface.
When a XRC file it being parsed in the application (using wxXmlResource
class), objects corresponding to the interface elements defined in .xrc
file are created and can be immediately used.
Please refer to the corresponding documentation depending on your language
for details.
XRC files are actually normal text files.
Structure of an XML file is defined by a hierarchy of
\emph on
nodes,
\emph default
each node is delimited by a pair of
\emph on
tags
\emph default
in a similar manner to HTML format.
XRC format uses a special
\family typewriter
object
\family default
tag for defining interface element nodes, which can contain a number of
\emph on
attribute
\emph default
nodes with tag names corresponding to the attribute names, e.g.
\family typewriter
<pos>100,100</pos>
\family default
.
Object nodes always have XML attribute
\begin_inset Quotes eld
\end_inset
class
\begin_inset Quotes erd
\end_inset
defined, e.g.
\family typewriter
<object class='wxFrame'>
\family default
.
\end_layout
\begin_layout Section
Getting started
\end_layout
\begin_layout Standard
XRCed interface contains these components:
\end_layout
\begin_layout Description
XML\InsetSpace \space{}
tree a tree representing the structure of the resource file.
\end_layout
\begin_layout Description
Attribute\InsetSpace \space{}
panel a panel with the information about the currently selected
tree item.
Class and object name is shown in the upper part and a notebook with a
number of pages is shown below for editing object's attributes.
\end_layout
\begin_layout Description
Pull-down\InsetSpace \space{}
menu is shown when a used right-clicks inside the tree control.
Is is used for creating new elements and basic operations such as copy/paste.
\end_layout
\begin_layout Description
Component\InsetSpace \space{}
panel is a graphical menu for creating new elements by clicking
on icons or by dragging them on the test window.
\end_layout
\begin_layout Description
Test\InsetSpace \space{}
window can be shown for an already existing part of the resource tree
to see the resulting appearance of the interface.
\end_layout
\begin_layout Standard
Using XRCed is easy once you understand some basic principles.
First of all, it is using a structure-oriented tree-based editing technique,
versus point-and-click method used in most GUI builders.
The tree is actually almost a direct respresentation of the hierarchy of
\emph on
object
\emph default
nodes in XRC file.
More precisely, only the nodes corresponding to visible interface elements
are shown.
An example of an object node which is not an interface element is the sizeritem
node.
\end_layout
\begin_layout Standard
XRCed tries hard to make accessible the full information contained in XRC
file, so even the nodes which are not shown in the tree must be represented.
This is done by adding their property pages to the attribute panel.
\end_layout
\begin_layout Standard
Secondly, creating new elements is context-dependent.
The new elements are inserted in the tree relative to the current selection
(except for drag-and-drop mode when the place is determined dynamically).
Sometimes there is an ambiguity on the exact position, because some elements
are
\emph on
containers
\emph default
which can have children, but it may be needed to create the new element
as a sibling node instead of a child.
Sibling mode can be forced by holding
\series bold
Ctrl
\series default
key on wxGTK/wxMSW or
\series bold
Alt
\series default
key on wxMac when inserting a new element.
Similarly, a new element can be inserted as the first child of a container
by holding
\series bold
Shift
\series default
key (default is to append it as the last child).
\end_layout
\begin_layout Section
Tree editing
\end_layout
\begin_layout Standard
When you create a new interface element it is attached at some point to
the existing XML tree.
The root node of the tree is created automatically and has only one attribute
- the encoding.
Root is not shown in the tree control (to save space), so its attributes
are visible when no other elements are selected.
\end_layout
\begin_layout Standard
As explained in the previous section, the new elements can be put in different
locations relative to the parent element.
What to do if the initial location is not correct, or should be changed
in the development process? There two ways to re-arrange elements:
\end_layout
\begin_layout Enumerate
Cut some element, then select the new parent or sibling and paste at the
new location.
Modifier keys can be used in the same way as for creating to alter the
default paste behaviour when using the pull-down command or the tool button
(pasting by using the keyboard shortcut is always using the default way).
\end_layout
\begin_layout Enumerate
Use one of the
\begin_inset Quotes eld
\end_inset
Move
\begin_inset Quotes erd
\end_inset
menu or toolbar commands to swap elements or change their parent/child
configuration.
If a move tool button is disabled, this means that it does not make sense
to do that kind of move due to incompatible parent/child configuration.
\end_layout
\begin_layout Standard
When you cut a subtree, all elements are cut to the clipboard and will be
pasted to the new location in the same configuration.
On some platforms the clipboard is shared among different processes, so
it is possible to start a second copy of XRCed and copy parts of one tree
into another.
\end_layout
\begin_layout Subsection*
Hidden nodes
\end_layout
\begin_layout Standard
Normally one tree element corresponds to a single <object> tag.
Sometimes it makes sense to associate contents of some <object> tags to
element attributes related to the parent.
A common example is a sizer object, which uses
\series bold
sizeritem
\series default
objects, which have a single child (a control or another sizer).
For such simple objects an attribute page is added to the child element
attributes.
The side-effect of this when copying a child from one parent's subtree
into a subtree of a parent of a different class, is that the hidden node
attributes must be discarded.
This is done automatically.
\end_layout
\begin_layout Subsection*
Cut/Copy/Paste
\end_layout
\begin_layout Standard
To accelerate your workflow it may be very useful to use keyboard shortcuts.
XRCed supports standard editing shortcuts for cut/copy/paste commands.
Pasting operation depends on the state of additional modifier keys to select
the desired pasting location relative to the active tree selection, in
a way similar to creating new nodes.
\series bold
Shift
\series default
modifier can be used with the toolbar Paste button or tree pulldown menu
to activate
\begin_inset Quotes eld
\end_inset
insert
\begin_inset Quotes erd
\end_inset
mode.
To activate sibling mode on wxGTK/wxMSW,
\series bold
Ctrl
\series default
or
\series bold
Alt
\series default
modifier is used depending on the platform and the way of introducing Paste
command:
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Standard
\backslash
begin{verbatim}
\end_layout
\begin_layout Standard
wxGTK and wxMSW wxMac
\end_layout
\begin_layout Standard
-------------------------------------------------
\end_layout
\begin_layout Standard
Tool button Ctrl Alt
\end_layout
\begin_layout Standard
Pulldown menu Ctrl Alt
\end_layout
\begin_layout Standard
Ctrl+V/Control+V shortcut Alt Alt
\end_layout
\begin_layout Standard
\backslash
end{verbatim}
\end_layout
\end_inset
\end_layout
\begin_layout Section
Defining attributes
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Standard
\backslash
image{}{attpanel.png}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Caption
\begin_layout Standard
Attribute panel
\end_layout
\end_inset
\begin_inset LatexCommand label
name "fig:attpanel"
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Attributes are edited using the attribute panel (Figure
\begin_inset LatexCommand ref
reference "fig:attpanel"
\end_inset
).
The upper part contains the class name field and, if applicable, the element
name field.
Lower part contains a notebook with one or several pages.
Normally the first page contains the main attributes, the second is
\begin_inset Quotes eld
\end_inset
Look'n'Feel
\begin_inset Quotes erd
\end_inset
page containing visual behaviour attributes such as font, colors, etc.,
the third is
\begin_inset Quotes eld
\end_inset
Style
\begin_inset Quotes erd
\end_inset
page with styles grouped in two columns -
\series bold
Generic
\series default
and
\series bold
Specific,
\series default
in addition some elements may have
\begin_inset Quotes eld
\end_inset
ExStyle
\begin_inset Quotes erd
\end_inset
page for defining extra styles and if there is a hidden node (such as for
sizer items or notebook pages) a page with hidden node attributes is shown,
named correspondingly.
\end_layout
\begin_layout Subsection*
Changing object's class
\end_layout
\begin_layout Standard
There are two ways to change the class of an element: by editing
\begin_inset Quotes eld
\end_inset
class:
\begin_inset Quotes erd
\end_inset
field in the attributes panel or by using
\begin_inset Quotes eld
\end_inset
Replace With
\begin_inset Quotes erd
\end_inset
pulldown menu command.
XRCed tried to preserve all attributes compatible with the new class.
\end_layout
\begin_layout Section
Test window
\end_layout
\begin_layout Standard
Test view is created simply by loading a part of the resource file using
XRC library, so it should look the same as in your application (without
the contents and changes performed by the program, of course).
There are elements which cannot be tested individually, but only as a part
of a subtree.
\end_layout
\begin_layout Standard
\begin_inset Quotes eld
\end_inset
Test
\begin_inset Quotes erd
\end_inset
command (View>Test or
\begin_inset Quotes eld
\end_inset
radioactive sign
\begin_inset Quotes erd
\end_inset
tool or F5) creates a view of the selected element or subtree.
If a top-level element (such as wxDialog) is selected, it is normally created
as a top-level window.
When the selected element cannot be a top-level window, a miniframe is
created and the test view is put inside.
Currenly shown parent element is made bold in the tree control while the
test window is opened.
\end_layout
\begin_layout Standard
It is possible to select an element by clicking on it in the test window
after activating the
\begin_inset Quotes eld
\end_inset
Locate
\begin_inset Quotes erd
\end_inset
command.
While the test window is open, it is possible to create new elements by
dragging a Component icon on the test window.
The parent element is highlighted by a blue box.
\end_layout
\begin_layout Subsection*
Auto-refresh mode
\end_layout
\begin_layout Standard
When auto-refresh is activated, any changes made to the attibutes or the
tree structure of the currently selected test subtree provoke test window
refresh (reload from the updated resource).
Sometimes it may be prefered to freeze the test window while making modificatio
ns by deactivating auto-refresh (from the View menu or using Alt+A keyboard
shortcut).
To force a refresh, press Ctrl+R or select View>Refresh command.
\end_layout
\begin_layout Subsection*
Highlighting
\end_layout
\begin_layout Standard
Selected elements are highlighted with red lines in the test window.
For sizers and sizer children in addition to the element bounding box XRCed
draws some additional lines showing border widths.
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Standard
\backslash
image{}{hl-sizer.png}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Caption
\begin_layout Standard
Highlighting for a box sizer
\end_layout
\end_inset
\begin_inset LatexCommand label
name "fig:hl-sizer"
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Standard
\backslash
image{}{ex1-tree.png}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Caption
\begin_layout Standard
XML tree
\end_layout
\end_inset
\begin_inset LatexCommand label
name "fig:ex1-tree"
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Figure
\begin_inset LatexCommand ref
reference "fig:hl-sizer"
\end_inset
shows how a box sizer is highlighted.
The tree view for this example is shown on Figure
\begin_inset LatexCommand ref
reference "fig:ex1-tree"
\end_inset
.
The top sizer (which is selected) is highlighted with a 2-pixel darker
box, and its children (wxBoxSizer and wxStdDialogButtonSizer) are highlighted
with 1-pixel lighter boxes.
Lines sticking out of the wxStdDialogButtonSizer indicate that it has borders
on all sides.
Finally, the horizontal line drawn across the wxBoxSizer indicates that
it has wxEXPAND flag set.
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Standard
\begin_inset ERT
status open
\begin_layout Standard
\backslash
image{}{hl-control.png}
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Caption
\begin_layout Standard
Highlighting for a control inside a sizer
\end_layout
\end_inset
\begin_inset LatexCommand label
name "fig:hl-control"
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Figure
\begin_inset LatexCommand ref
reference "fig:hl-control"
\end_inset
shows how a control inside a sizer (the wxTextCtrl object) is highlighted:
only the bounding box and borders are drawn.
\end_layout
\begin_layout Standard
When auto-refresh is off, the highlight follows selection until the tree
structure is modified.
To re-activate highlighting again Refresh command must be used.
\end_layout
\begin_layout Standard
In addition to the active selection highlighting, when using drag-and-drop
to place new elements on the test window, an element serving as a reference
for the new element is highlighted with a blue rectangle.
The new element will be appended as a child or a next sibling of the reference
element depending if it is a container or not and the state of the modifier
key.
\end_layout
\end_body
\end_document
|