MQStationPlugin class

(new in Rev2.40)

MQStationPlugin class inherits MQBasePlugin class, and provides functions necessary for an implementation of a station plug-in.

You can make a station plug-in with a simple implementation and without taking care of complex message procedures between a plug-in and a main part of Metasequoia by inheriting this MQStationPlugin class and implementing required virtual functions.

In MQCommandPlugin class, each plug-in member functions and messages are declared as virtual functions. It is necessary to implement the virtual function in the inherited class.

 

Class
MQStationPlugin Constructor
~MQStationPlugin Destructor
Declared in super class
GetPlugInID Get a plug-in ID
GetPlugInName Get a plug-in name
Plug-in
GetPlugInType Get a plug-in type
EnumString Get a string displayed in a menu or on a button
Initialize Initialize an application
Exit Exit an application
Message procedure
Activate A message for activating or deactivation a window
IsActivated A message for checking an activated state of a plug-in
OnMinimize A message for minimizing a window
OnReceiveUserMessage A message for receiving a plug-in own message
OnDraw A message for drawing
OnNewDocument A message for initializing a document
OnEndDocument A message for exiting a document
OnSaveDocument A message for saving a document
OnUndo A message for an undo
OnRedo A message for an redo
OnUpdateUndo A message for updating an undo state
OnObjectModified A message for editing objects
OnObjectSelected A message for selecting objects
OnUpdateObjectList A message for changing a current object
OnMaterialModified A message for modifying parameters of materials
OnUpdateMaterialList A message for changing a current material
OnUpdateScene A message for updating a scene
Supplemental functions for the super class
OpenSetting Open a setting file
CloseSetting Close a setting file
SendUserMessage Send a plug-in own message to the other plug-ins
Supplemental functions
WindowClose Close a window
BeginCallback Begin the callback procedure
ExecuteCallback Implementation for the callback
CreateDrawingObject Add a drawing object in OnDraw()
CreateDrawingMaterial Add a material for a drawing object in OnDraw()
DeleteDrawingObject Delete a drawing object
DeleteDrawingMaterial Delete a material for drawing objects
GetCurrentUndoState Get a current undo state
GetSceneOption Get display options of the scene

MQStationPlugin::MQStationPlugin();

This method is a constructor.


virtual MQStationPlugin::~MQStationPlugin();

This method is a destructor. It is defined as a virtual function.


virtual int MQStationPlugin::GetPlugInType();

Return value
A plug-in type
[MQPLUGIN_TYPE_STATION] Station plug-in

This method implements a virtual function declared by MQBasePlugin::GetPlugInType(). No additional implementation is not necessary in an inherited class.


virtual const char *MQStationPlugin::EnumString();

Return value
A string displayed in a menu or on a button

It returns a display string in a menu (for Station plug-in) or on a button (for Command plug-in).

This method is declared as a pure virtual function, and it disappears MQEnumString() by implementing in the inherited class.


virtual BOOL MQStationPlugin::Initialize();

Return value
Whether to succeed to initialize
[TRUE] Succeeded to initialize
[FALSE] Failed to initialize

This method is called when Metasequoia starts up or after loading the plug-in DLL by the "About plug-ins" dialog.

This method is declared as a pure virtual function, and you must implement in an inherited class. Though what to be implemented is not specified, it generally creates a window displayed when it is called from a menu.

 

Attention: In Ver2.4.3 or older version, Initialize() is also called multiply after loading the DLL for a bug. It is only called just after loading the DLL in Ver2.4.4 or later version


virtual void MQStationPlugin::Exit();

This method is called when Metasequoia quits or before unloading the plug-in DLL by the "About plug-ins" dialog.

This method is declared as a pure virtual function, and you must implement in an inherited class. Though what to be implemented not specified, it generally releases resources allocated by Initialize().


virtual BOOL MQStationPlugin::Activate(MQDocument doc, BOOL flag);

doc
An document
flag
A required active-state
[TRUE] Required to activate a window
[FALSE] Required to deactivate a window
Return value
Whether to succeed the required procedure
[TRUE] The procedure has been succeeded
[FALSE] The procedure has not been done with

This method is called to changed the activation state when the menu for this plug-in is clicked.

This method is declared as a pure virtual function, and you must implement in an inherited class. Though what to be implemented is not specified, it generally shows or hides a window created by Initialize().

Regardless of the required active-state, it must return the active-state after calling this function.


virtual BOOL MQStationPlugin::IsActivated(MQDocument doc);

doc
An document
Return value
Whether to be active
[TRUE] Active
[FALSE] Inactive

It returns whether this plug-in  is active.

This method is declared as a pure virtual function, and you must implement in an inherited class.

Though what to be implemented is not specified, it generally returns TRUE when the window managed in the plug-in is displayed, and returns FALSE when it is hidden.


virtual BOOL MQStationPlugin::OnMinimize(MQDocument doc, BOOL flag);

doc
An document
Return value
Whether to minimize
[TRUE] Minimized
[FALSE] Restore to the state before minimized

This method is called when a main window of Metasequoia is minimized.

This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.


virtual int MQStationPlugin::OnReceiveUserMessage(MQDocument doc, DWORD src_product, DWORD src_id, const char *description, void *message);

doc
An document
src_product
A product ID of a sender plug-in
src_id
A plug-in ID of a sender plug-in
description
A string representing the contents of the message
message
A content of the message
Return value
An arbitrary value to return to the sender plug-in

(new in Rev2.41)

This method is called when a message by MQBasePlugin::SendUserMessage() is sent from the other plug-in.

This method is declared as a virtual function, and it does nothing in a default action. You can exchange data between plug-ins by implementing in an inherited class and a sender plug-in if necessary.


virtual void MQStationPlugin::OnDraw(MQDocument doc, MQScene scene, int width, int height);

doc
An document
scene
A scene
width
A width of the drawing area
description
A height of the drawing area

This method is called when the drawing a scene.

This method is declared as a virtual function, and it does nothing in a default action. You can draw your own plug-in object in the scene by implementing in the inherited class if necessary.

An object or a material used only while a drawing can be created by CreateDrawingObject() or CreateDrawingMaterial().


virtual void MQStationPlugin::OnNewDocument(MQDocument doc, const char *filename, NEW_DOCUMENT_PARAM& param);

doc
An document
filename
File name
[not NULL] The filename when MQO file has been loaded
[NULL] Created as a new document
param
Initial parameters

This method is called when a document is initialized.

filename is set only when a MQO file has been loaded, and it is NULL when other format file has been imported.

If a XML element has been registered through OnSaveDocument() when saving a file, the XML element will be set in param.elem.

This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.

struct NEW_DOCUMENT_PARAM {
    MQXmlElement elem;
};
elem
[not NULL] A xml element added when a file is saved
[NULL] It is created as a new document, or a XML element has not been saved

virtual void MQStationPlugin::OnEndDocument(MQDocument doc);

doc
An document

This method is called when a document exits.

This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.

When a drawing object or a material created by CreateDrawingObject() or CreateDrawingMaterial() which instant is FALSE remains, please delete it by DeleteDrawingObject() or DeleteDrawingMaterial() in this function.


virtual void MQStationPlugin::OnSaveDocument(MQDocument doc, const char *filename, SAVE_DOCUMENT_PARAM& param);

doc
An document
filename
MQO file name
param
Saving parameters

This method is called just before saving a document to a MQO file.

A XML element is set in param.elem, and plug-in own data can be saved together with a .MQO file by registering the child element. The XML element is saved in an external XML file, and it is linked from a MQO file.

This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.

struct SAVE_DOCUMENT_PARAM {
    MQXmlElement elem;
    BOOL bSaveUniqueID
};
elem
[not NULL] A xml element added when a file is saved
[NULL] It is created as a new document, or a XML element has not been saved
bSaveUniqueID
Whether to save an unique ID in a MQO file

virtual BOOL MQStationPlugin::OnUndo(MQDocument doc, int undo_state);

doc
An document
undo_state
An undo state counter
Return value
Whether to do with data in the document by a plug-in own undo operation
[FALSE] Not operate

This method is called when an undo is operated.

This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.

 

In current version, a plug-in own undo operation is not allowed. You can refer data in the document and do with plug-in own data managed. But, do not do with data in the document. Return FALSE always. A return value is reserved for a future version.


virtual BOOL MQStationPlugin::OnRedo(MQDocument doc, int redo_state);

doc
An document
redo_state
An undo state counter
Return value
Whether to do with data in the document by a plug-in own redo operation
[FALSE] Not operate

This method is called when a redo is operated.

This method is declared as a virtual function, and it does nothing in a default action. You can do some operations by implementing in the inherited class if necessary.

 

In current version, a plug-in own redo operation is not allowed. You can refer data in the document and do with plug-in own data managed. But, do not do with data in the document. Return FALSE always. A return value is reserved for a future version.


virtual void MQStationPlugin::OnUpdateUndo(MQDocument doc, int undo_state, int undo_size);

doc
An document
undo_state
An undo state counter
undo_size
A number which can operate an undo

This method is called when an undo state has been updated.

Do not modify objects moreover in this function.


virtual void MQStationPlugin::OnObjectModified(MQDocument doc);

doc
An document

This method is called when an object is modified.

Do not modify objects moreover in this function.


virtual void MQStationPlugin::OnObjectSelected(MQDocument doc);

doc
An document

This method is called when vertices, lines, faces or UV vertices in objects are selected.

Do not modify objects or the selection moreover in this function.


virtual void MQStationPlugin::OnUpdateObjectList(MQDocument doc);

doc
An document

This method is called when a current object is changed, or an object is added or deleted.

Do not modify objects or the selection moreover in this function.


virtual void MQStationPlugin::OnMaterialModified(MQDocument doc);

doc
An document

This method is called when a parameter in a material is changed.

Do not modify objects or materials moreover in this function.


virtual void MQStationPlugin::OnUpdateMaterialList(MQDocument doc);

doc
An document

This method is called when a current material is changed, or a material is added or deleted.

Do not modify materials moreover in this function.


virtual void MQStationPlugin::OnUpdateScene(MQDocument doc, MQScene scene);

doc
An document
scene
A scene

This method is called when a scene information is changed such as a direction of a camera or a zoom rate.

Do not modify the scene moreover in this function.


void MQStationPlugin::WindowClose();

If you call this method when the window managed by this plug-in is closed, it will be notified to the main part of Metasequoia and the check on a menu will become off.


void MQStationPlugin::BeginCallback(void *option);

option
An arbitrary data to give to a callback function

Call this function when you want to process the response for Windows messages in a plug-in. After an initialization, ExecuteCallback() will be called and you can do with a process for a MQDocument in the function.


virtual void MQStationPlugin::ExecuteCallback(MQDocument doc, void *option);

doc
An document
option
An arbitrary data given by BeginCallback()

A callback procedure called by BeginCallback() is implemented in this function.

This method is declared as a pure virtual function, and you must implement in an inherited class.


MQObject MQStationPlugin::CreateDrawingObject(MQDocument doc, DRAW_OBJECT_VIISIBILITY visibility, BOOL instant=TRUE);

doc
An document
visibility
[DRAW_OBJECT_POINT] Show vertices
[DRAW_OBJECT_LINE] Show lines
[DRAW_OBJECT_FACE] Show faces
instant
Whether to create as a temporal object

It adds a drawing object while OnDraw() is called.

The created object must not be deleted by MQObject::DeleteThis() or MQDocument::DeleteObject().

The object created with specifying TRUE for 'instant' will be deleted automatically after drawing is completed. The object created with specifying FALSE for 'instant' must be deleted by DeleteDrawingObject() when is becomes unnecessary or OnEndDocument() is called.


MQMaterial MQStationPlugin::CreateDrawingMaterial(MQDocument doc, int& index, BOOL instant=TRUE);

doc
An document
index
An index of the created material
instant
Whether to create as a temporal material

It add a material for a drawing object created by CreateDrawingObject() while OnDraw() is called.

The index stored in the 'index' variable is available for MQObject::SetFaceMaterial().

The created material must not be deleted by MQMaterial::DeleteThis().

The material created with specifying TRUE for 'instant' will be deleted automatically when drawing is completed. The material created with specifying FALSE for 'instant' must be deleted by DeleteDrawingMaterial() when it becomes  unnecessary or OnEndDocument() is called.


void MQStationPlugin::DeleteDrawingObject(MQDocument doc, MQObject obj);

doc
An document
obj
A drawing object

It deletes a object created by CreateDrawingObject() which the 'instant' is FALSE.


void MQStationPlugin::DeleteDrawingMaterial(MQDocument doc, MQMaterial mat);

doc
An document
mat
A material for drawing objects

It deletes a material created by CreateDrawingMaterial() which the 'instant' is FALSE.


int MQStationPlugin::GetCurrentUndoState(MQDocument doc);

doc
A document
Return value
A counter of an undo state

It gets a counter of an undo state.


void MQStationPlugin::GetSceneOption(MQScene scene, SCENE_OPTION& option);

scene
A scene
option
Display options

It gets display options of the scene.

struct SCENE_OPTION {
    BOOL ShowVertex;
    BOOL ShowLine;
    BOOL ShowFace;
    BOOL FrontOnly;
    BOOL ShowBkimg;
};
ShowVertex
Show vertices
ShowLine
Show lines
ShowFace
Show faces
FrontOnly
Show front faces only
ShowBkimg
Show background images