Vyzor

From Mudlet
Jump to navigation Jump to search

Author

Name
Erik Pettis
Forum Name
Oneymus

About

Link
Mudlet Forums
Beta Release
January 8th, 2012
Source Code
Github

Vyzor is a GUI framework that provides an object-oriented interface for Mudlet's Labels and Qt's Stylesheets. It provides Frames (Vyzor's container object) mapped to Mudlet's borders, which update dynamically or maintain a size specified by the user. Users creates Frames, and can define them using values relative to parent Frames; in this way, you can have widgets that properly map to, say, the right side of the main console. All Frames can be filled with Components, which map directly to Stylesheet Properties.

References

Qt 4.7 Reference Sheet

Project

Known Issues

ToDo

  1. Implement Component inheritance to mimic Stylesheet cascading.
  2. Nested Labels (see GeyserLabel.lua)
  3. Allow Adding Frames to and Removing Frames from Box Compound
    1. The idea here is for run-time editing, but since you can't change Label layering post-creation, is this even feasible? In fact, I should assess the feasibility of ANY run-time modifications to GUI state.

Updates

2012-01-18

Additions
  1. Added MiniConsole support.
  2. Added Map support.
  3. Added Gauge support via new type: Compound.
Fixes
  1. Solved a previously unknown problem with top and bottom Border Frames maximizing.

2012-01-23

Additions
  1. A new alias, "vyzor help|vyhelp|vyh". In theory, would open the documentation in a browser. Didn't work for me.
Fixes
  1. Gradients now work properly. The change to LuaJIT required a change in variable arguments.
  2. Options.DrawOrder now functions. Border Frames (and children) will now be drawn in the specified order.
  3. Borders and Backgrounds should now function without content (Brush or Image).

2012-02-06

Additions
  1. Gauges:
    • Can now supply a table of Frames as the last argument to the Gauge constructor. These Frames will be used when current values exceed the maximum value. If there are no overflow gauges (or current exceeds overflow), the final Gauge will properly draw at 100%.
    • Gauges now have an internally generated caption Frame. This can be echoed to using <gauge>:Echo(text). If no text is supplied, the Gauge will echo according to a supplied TextFormat (should be string.format compatible, with two values).
    • Gauges are now created with AutoEcho true, meaning they will echo to the Gauge every time Update is called. This can be turned off with <gauge>.AutoEcho = false
  2. Frames and MiniConsoles now possess wrappers for the remaining relevant Mudlet functions:
    • Echo
    • CEcho
    • DEcho
    • HEcho
    • EchoLink
    • EchoPopup
    • Paste
    • Clear
  3. Additionally, Frames possess two new Properties:
    • Callback - Used to set a callback function. Must be a string.
    • CallbackArguments - Used to pass arguments to a callback function. Should be a table.
  4. MiniConsoles also have AppendBuffer(), but functionality seems identical to Paste().
Fixes
  1. Frames should now be guaranteed to draw in the correct order, thanks to the addition of a custom OrderedTable() function. See vyzor/lib for details.

2012-02-26

Additions
  1. Created a Vyzor page on the Mudlet Wiki. In order to maintain brevity of this post, the Known Issues, ToDo, and Update lists will be maintained there. Additionally, there will some day be a usage guide and (possibly) documentation there. There will, however, always be the last update on this post for easy reference.
  2. Added a Box Compound that automatically arranges Frames.
    1. Boxes can be Horizontal (left->right), Vertical (top->bottom), or in a Grid (left->right, top->bottom).
    2. This is set via BoxMode Enum.
    3. This will lead to a Chat Compound and a Nested Labels (fly-out) Compound.
Fixes
  1. Resolved an issue with setting MiniConsole properties post-creation. I had put the function in the wrong place. =p

2012-05-24

Additions
  1. Chat Compound
    1. Can now create a handy-dandy tabbed chat Compound.
    2. Can have any number of windows to which text can be sent, switched via clicking on tabs.
    3. The Chat Compound itself uses a Background Frame that the user provides, allowing for customization.
    4. A table of Components can be passed to Compound which will be applied to all created tabs.
    5. If one of the channels is "All", it's used as a bucket. This is optional.
  2. Convenient shortcuts to the Border Frames. Instead of Vyzor.HUD.Frames[...], Border Frames can now be accessed with Vyzor.Top, Vyzor.Right, Vyzor.Bottom, and Vyzor.Left.
  3. Events
    1. VyzorDrawnEvent is raised after Vyzor has finished drawing everything.
    2. VyzorResizedEvent is raised after Vyzor has successfully resized everything. Be warned, this can happen a lot when resizing.
    3. VyzorLoadEvent is raised after Mudlet successfully loads the Vyzor package. This should be used to initialize GUI scripts.
  4. VyzorInitializeGauges: A global event handler for VyzorDrawnEvent. Initializes the Gauges (basically an update call).
  5. Vyzor no longer assumes control of Mudlet's borders on start-up. By setting Options.HandleBorders to one of three options, you can control how Vyzor assumes control.
    1. true - Vyzor will always control Mudlet's borders. This is how it currently functions.
    2. "auto" - Vyzor will assume control upon a Vyzor.HUD:Draw() call.
    3. false - Vyzor will never assume control of Mudlet's borders.
Fixes
  1. Removed improper echo functions from Frames.
  2. Changed Hover functions to reflect similar Frame functions (Add, Remove).
  3. Top and Bottom Border Frames can no longer go negative. This should prevent the main console from appearing outside of your visible space.
  4. The Box Compound now accepts a background Frame instead of dimensions. This change brought Boxes in line with other Compounds, and also allows you to pass a customized Frame to the entire Box.
  5. Alias "vyzor help" now works. Turns out, on Windows, you need to call gsub("\\", "/") on getMudletHomeDir() to make things work. Same thing for my SampleGui.
    1. Also, "vyzor help" will use openWebPage() if it exists.
  6. Fixed a bug that prevented Borders from working without Content.
  7. Gradients now use tables for their stop/Color pairs. This should make it easier to pass a long list of stops to gradients.
    1. Also, I figured out what cx/cy and fx/fy mean for radial Gradients. c* = the center of the circle. f* = the point from which the colors radiate.

Documentation

API Reference
Link
This is comprehensive reference to Vyzor's API. Everything necessary to work with Vyzor should be contained herein.
Sample Walkthrough
Link
This is a walkthrough of the SampleGUI package I provided to showcase Vyzor.
Source Documentation
Link
This is an HTML dump of the auto-generated source documentation of Vyzor. Produced by NaturalDocs.

License

Copyright (c) 2012 Erik Pettis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.