Old Virtual Pen Project History
30-31 August 2002, 1 September 2002
- Experimenting with the fonts and the code published in Windows Graphics
Programming.
29 August 2002
- Working on path expansion/contraction code. The code works properly and it
is now possible to expand and contract a polygon, taking into account the
special cases when a connection at a vertex becomes very sharp (degenerated
case) and cutting it off (just as PostScript does with the miter limit).
28 August 2002
- Implemented polygon intersection code : VP::TextLib::PolygonTools.
- Added a new attribute to the engine : VP::DocAttr::TextFrame.
This will be responsible for turning a GDI+ path into an internal polygonal
representation.
- Found a hack to fix the line width of thin lines. Apparently, GDI+ Pen::SetWidth
will round the pen width to 1 if it is set to a smaller value. The solution
is to scale the graphics path by 100 before widening it, widen it and
then scale it back to its original size.
With this trick, the pen width can then be specified exactly down to a width
of 0.0035 mm...
- The paint-op is no longer removed from its rendering stack in case
a OBJCAT_BLOCK_END_KEEP block gets executed.
This allows the TextFrame attribute to hook
into the painting process and extract the GDI+ path before it gets used for
painting.
- Implemented vertical line placement, based on fictitious line heights.
- Found and fixed a bug with the intersection code, in some special cases
(when the line goes through one of the edges).
- Added path direction detection code, which allows to know what to consider
as the interior and what to consider as the exterior. This works only for
non-self-crossing paths.
27 August 2002
- Starting work on text object in Virtual Pen. Here is the current
planning :
- Implement polygon intersection, used to find out how to place the
lines within a complex shape (a polygon, possibly with holes in it). ü
- Implement vertical line placement (place horizontal collections of
boxes so that they fit below the previous line or the top of the
encompassing shape). ü
- Implement analysis of Font/Text geometry.
- Implement crude justification code (H&J version 0) in order to
split the line.
- Implement horizontal placement of the boxes on a line.
- ...
- Bug with thin lines : they don't become thinner than about 0.3mm. ü
26 August 2002
- Finishing common dialog handling.
- Printing works ! There were several small problems with the first,
naïve, implementation :
- The internal resolution provided by the PrintPageEventArgs.Graphics
context is set to 100 dpi, whatever the printer resolution really
is. Since the display returned 96 dpi, there was a 4% size
difference between what was displayed and what was printed.
- The physical margins of the page were not taken in account. This
required a call to the native Win32 GetDeviceCaps.
- Improved the ask dialog. It displays an icon and plays the asterisk
sound...
25 August 2002
- Continuing improvement of document handling and standard document dialogs.
- Improved line breaking algorithm used in the HelpAreaLabel
widget. No line breaks will be forced immediately before punctuation marks.
And the helper now supports multi-paragraph text.
- Commands such as Undo and Redo get disabled when the actions are
impossible.
- The empty.vp file is now stored in the
temporary folder with a revision specific name. The vp.startup.ini
file is now loaded from an absolute path.
24 Ausust 2002
- Debugging a graphic problem in DocViewScrollable.
Reducing the size of the widget did not redraw it (this must be forced
manually with a call to Invalidate).
- Replaced former menus by those implemented by the magic library.
- Added message filtering in the command sink to handle the shortcut keys
(this is no longer done automatically with the Magic library).
- Added a simplified way to implement command processing. You only have to
implement a class called CommandProcessor
residing in the VP.FrontEnd.Cmd.Xyz
namespace (where Xyz is the command
name). Its Execute method will automatically
get called when a GUI.Xyz command gets
executed by the command hub.
- Working on standard document dialogs (created a VP.FrontEnd.Logic.Document
class to handle the basic document settings).
23 August 2002
- Working on Crownwood's magic library to get the menus paint and behave the
way I want. There were quite a few details related mainly to the fact that I
have two monitors, with one in the negative coordinate space. Sent the
updates to Phil Wright...
- Built the magic library into VP, as the VP.Magic
namespace.
22 August 2002
- Fixing problem found yesterday evening : the problem was that VP did
not patch existing styles when the user switched from color to hatch (or
vice versa), but only regenerated the default family style.
- Implemented style patching in AttributeEditor
only to find out that I already had this function in method ReplaceStyles !
But this allowed me to find an error in ReplaceStyles,
which cloned styles before throwing them away...
- Fixed command VerifyFamilySelStyle to handle family
mismatches (if the active family changes, the appropriate commands are
generated automatically).
- The paint switching finally works as intended.
- Trying out Crownwood's magic library,
and debugging the menu handling code.
21 August 2002
- Finishing the attribute palette.
- First successful boot of Virtual Pen using a script-based family
initialisation... The vp.startup.ini file
contains all the family and style creation commands needed to provide very
simple defaults.
- The families are no longer sorted by their type (surface, outline,
regular)... Every family is now attached to a preferred UCID (if any) and a
set of flags defines whether the family has to be considered as an active
style provider for one of the style classes (surface, outline, regular).
Styles in a family can be selected twice, for instance once as a surface
painting style and once as an outline painting style.
All these changes were far reaching (mainly in the document manager automatic
family style handling code).
- Fixed a bug revealed when defining both the outline and the surface to be
the same color. The GUI would always edit the outline first (it had no way
to know what path was followed from the style to the attribute definition,
and thus could not find out if it was embedded in a surface or an outline
moderator).
- Hunting one more bug when switching from color to hatch...
20 August 2002
- Still working on the implementation of the attribute creation commands and
the variables in the command hub. It is now possible to execute following
command sequence :
doc.TransactionBegin
var.Push
doc.QueryFamilyIndex 1
doc.CreateStyle {var:1} Regular
# Remember style index for future use. For now, find insertion point in style
# (which is at 'style index' + 2).
var.Push
var.Add 2
doc.CreateObject Simple 1029 {var:1} Regular
# The CreateObject returns two values. We only need the first one, so split
# the result and get element 0.
var.Split 0
# Set the property values of the object we have just created
var.Push
doc.AttrSetValue {var:1} 0.0 0RGBr 0.1 200RGBg 0.2 100RGBb
var.Pop
# Now, get back to the style and make it the active style in family '1'.
var.Pop
doc.SetFamilySelStyle 1 {var:1}
doc.UpdateDefaultFamilyStyle
var.Pop
doc.TransactionValidate
- This required the addition of style selection and family manipulation
commands.
18-19 August 2002
- "Off by one day" week-end.
17 August 2002
- Finishing implementation of the variables in the command hub.
16 August 2002
- Added support in the command hub to manage variables in a very simple
way :
- var.Push defines a new variable
context on the stack.
- var.Pop removes a variable context
from the stack.
- var.Read returns the current (top)
variable value.
- var.Write x sets the current (top)
variable value to x.
- ...{var:n}... in a command is
replaced with the variable of level n in the variable stack (1 =
top of stack, 2 = next, etc.).
- All commands which return a result will store it in the topmost
variable context (if any).
- Reorganising the families :
- Added the missing commands to query the family information.
- Added more information into the families (preferred UCID,
an active flag, etc.)
15 August 2002
- Hunting a strange bug which happens only in optimized C# code...
Somehow, one of the MeasureString methods
believed that it was handling with a null pointer. Dereferencing the array
before using it fixed the problem !?
- Fixed a small problem with hatches where one of the colors was fully
transparent.
- Fixed a problem with scrolling : when the scrollers were modified by
hand (not automatic scrolling), the the selection rectangle would jump
around.
- Added "hot" attribute tiles : when the user points on a
style sample, the matching selected objects get hilited in the document.
- Analysing how families work and how I can use them for the different
attribute family definitions.
14 August 2002
13 August 2002
- Finishing the attribute palette, so that it behaves as designed on paper.
This is now almost the case. The hatch attributes can be edited and its
colors too. This was tough...
12 August 2002
- Added a summary list to the VP.FrontEnd.GUI.AttributePanel
class, which gets populated thanks to the VP.PIS.GUI.IAttribute.CreateSummaryListItem
method (for attributes such as the hatch or the color).
- Implemented a draft GUI for the hatches.
- The summary list shows the hatch and color attributes, but
it is not finished yet.
- Improved VP::Unit::Val to
handle the enumeration type properly when passing it to the C# front-end as
a string (and getting it back afterwards).
- Improved the resource handling in the plug-in base classes.
10-11 August 2002
- No work for EPSITEC this week-end.
9 August 2002
- I tried a slightly different figure region definition, where both a clipping region and a
path are used. Here are a few cases to explain how this works :
- In a colored outline, the clipping region is set to infinite (or to
the display region for that matter) and the path is set to the outline
surface.
- In a colored surface, the clipping region defines the surface boundary
and the path defines the bounding box of the surface (this is different
from the colored outline, since the surface needs to be defined as the
difference between the figure path and its outline surface).
- In a hatched surface, the clipping region defines the surface boundary and the path defines the
stripes of the hatch.
- All this gives excellent speed results. It seems that GDI+ performance
degrades only when the region becomes slightly more complex (several
stripes), and a polygonal clipping path is still handled quite fast.
- Implemented all possible hatch angles (0 to 90 is handled by one case, 90
to 180 by another one).
- Experimented with various ways to paint multiple hatches with a single
path definition.
- Added support for bi-color hatches (background color is painted as a figure
variant and hatch color is painted as another one).
8 August 2002
- I implemented the hatch drawing in VP. This required a bit of maths (I am
becoming rusty in trigonometry, I realise). The hatch is drawn using the figure
region defined in the rendering context. But I realised this afternoon
that, somehow, GDI+ is not at all suited for filling complex regions :
calling FillRegion on a figure took
4500 ms, where the same figure painted with FillPath
only took 2 ms. What is going on ???
- Trying to find an alternate way to display hatches in GDI+.
7 August 2002
- Implementing the attribute palette scroll list.
- Implementing the basic mechanisms needed by the hatch brush, so that we
can experiment with it in the attribute palette.
- Added PushFigureRegion and PopFigureRegion
to the VP::Render::Context. When pushing a
figure region (defined by a graphics path object), the rendering context
will automatically compute the intersection with the active (parent) region.
- The A-Surface and A-Outline
attributes now use the figure region for painting and the A-Color
class supports both the old drawing method and the new, figure based
painting.
- The holes between the outline and the surface have
now disappeared, but very thin lines are no longer painted with the
minimum thin line width (1-pixel). They might disappear or be displayed only
partially. This is not very pleasant; I guess I should handle very thin
lines in a special way.
6 August 2002
- Read Feng Yuan's wonderful book
about GDI and Win32 programming (over 1200 pages, a real must read !).
5 August 2002
- Fitting the customised ListBox tool
classes back into VP.Forms.
- Designing the interaction between the hatch brush and the attribute
palette.
4 August 2002
- Implementing paint definition scroll list : my first attempt at using
a class provided on CodeProject was not a good idea (flawed code, not real
list box implementation); I then switched to the real System.Windows.Forms.ListBox
class and implemented drag & drop support and custom drawing.
This code will flow into VP tomorrow.
3 August 2002
- Improved painting of the image buttons.
- Implemented image compositor (to create a paint bucket with the proper
paint, for instance).
2 August 2002
- Working on the attribute palette, mainly design. I currently favour a
solution which is less compact than what we discussed with Daniel, but which
might be clearer.
1 August 2002
- No work today (Fête Nationale).
31 July 2002
- Continuing cleanup in VP.FrontEnd.Logic.Selector,
VP.FrontEnd.GUI.SamplePalette, etc.
- Redrawing of the samples by the sample palette is now also done in the
main RefreshContents method, which provides
a much smoother display.
- The displayed sample matches the selected object(s). If several different
objects are selected, then the default polyline sample is used. Perhaps we
should have a special shape, different from the default polyline
sample ?
- Improved thin line selection : the visual feed-back has now a minimal
width, which makes it visible whatever scale the document is displayed
in.
30 July 2002
- Debugging : fixed an assertion failure in the grip management, caused
by a bug in DocObj::MultiPtCreator.
- Working on the attribute palette.
- Afternoon off duty.
29 July 2002
- Fixed following small problems :
- Do not display first grip while creating a figure such as a polygonal
line.
- Moved sub-tools creation into the MainToolBase
class (this is no longer the responsibility of the SamplePalette,
which allows for a much simpler update and expansion of the tools).
- Added customised attribute edition (e.g. hiding of the unused surface
attribute for a segment).
- Debugging.
- Started redesign of the attribute palette.
26 July 2002
13-25 July 2002
12 July 2002
- Rewritten the string width calculation, using a simpler method than the
previous rendering to a monochrome 1-pixel high bitmap.
- Finishing the implementation of the help area label class, which needed
the ability to display rich text. Currently, there is a very simple parser
in the VP.Forms.ThemeHelper class, which
recognizes the <b> and </b> tags.
11 July 2002
- Improving creation : primary and secondary grips are only detected if
the Shift key is held down; automatic validation grips (open/close) are
detected if Shift is not held down.
- Worked on the help area in the main tool palette. Daniel won't like it,
but I do :-)
10 July 2002
- Trouble with my disk mirroring setup. I spent almost all day trying to get
it work again properly...
09 July 2002
08 July 2002
- Implemented grip management during object creation : this allows the
user to move grips in a figure while the figure is being created. This works
also with the undo/redo features, but needed a few fixes to the object
creation code (grips were not numbered properly and information was not
always stored in the proper fields).
- Experimented with keyboard event handling and pre-processing (which will
be needed to trap the Alt key and inhibit the automatic repetition events
sent by Windows for Shift, Ctrl and Alt keys).
07 July 2002
06 July 2002
- The bug hit on 03 July was in fact the combination of several problems,
which had to be addressed separately :
- Moving in the command list did not properly hand the FORK
markers.
- Redoing a list of commands which included a FORK
marker skipped the element immediately after the FORK.
- Undoing and redoing interfered with the temporary point creation; now,
after every undo and redo event, the object creator (ObjectCreation.cs)
queries the core to know if/what object is being edited.
- The grips added during creation by the VP::DocObj::GraphicCreator
were not all removed.
- Downloaded OpenOffice sources. I think there might be interesting code in
the MySpell tools... Also explored the ispell
solution.
- I finally got access to Microsoft Typography Group's Open Type Layout
Services Library (OTLS), which might help me in the OpenType information
extraction, when implementing text into VP.
05 July 2002
04 July 2002
- Mostly reading today. Because of other
03 July 2002
- Working on creation feed-back : show the grips of the objects being
created. While working on this feature, I hit a bug with undo/redo commands
while creating a figure.
- Afternoon: no work...
02 July 2002
- Candidate highlighting of objects with transparent surfaces also
highlighted the surface, which was not a good idea when painting wires with
the polyline. Fixing this required quite a bit of work in the a.selgrips
management class (more specifically, it has to analyse the a.alpha
attribute found in the a.surface moderator,
but without doing any painting).
- Broadcast a VP::CoreEvent::Doc_UndoRedoPending
event before any undo/redo operation (without any delaying), so that the
anyone who tweaked the document may restore it to a safe state (see below).
- Fixed a few problems with the temporary line which is following the cursor
(especially with respect to undo/redo and tool switching).
- Surface testing also tests the outline of the figure, so that figures with
a large outline get detected in an intuitive way.
- Fixed two bugs related with the loading of a document with mismatched
plug-ins :
- The missing type definitions (UCID
to type mapping) were not added properly in the document, and the wrong
index was used to declare the new type definition objects.
- The document views were not reinitialised, which caused
trouble since the associated document view definition object could be
located elsewhere in the newly loaded document. A full delete
and reconstruction of all VP::DocView
instances is needed when the Reset event
is generated internally.
- Compiled paintlib
under Visual Studio .NET (this might become a component of VP in the near
future).
- Fixed graphic glitches related to the asynchronicity of the BelowCursorFinder
class (this took me about 6 hours, until late in the night to get it right).
01 July 2002
- After getting feed-back from Daniel about the version I sent him on last
Friday, there were a lot of small things to fix in the user interface behaviour.
I almost fixed everything (there are still 5 open problems).
- When creating a polyline, display the last segment from the current end
point to the cursor position, even when the user does not press and
drag : this gives a better visual feed-back of what is happening.
- Transparent surfaces don't automatically get detected. The user has to
press CTRL in order to activate transparent surface detection.
- When switching tools, the object creation is validated.
History of previous months.