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 MQStationPlugin 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
EnumSubCommand Enumerate sub commands
GetSubCommandString Get a sub command's displayed string
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
OnSubCommand A message for calling a sub command
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
OnChangeEditOption A message for chainging an edit option
Supplemental functions for the super class
OpenSetting Open a setting file
CloseSetting Close a setting file
GetResourceString Get a resource string
GetSettingValue Get a setting value
GetSystemColor Get a system color
GetResourceCursor Get a default mouse cursor
GetScreenMouseCursor Get a mouse cursor for a screen
SetScreenMouseCursor Set a mouse cursor for a screen
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()
CreateDrawingText Add a drawing text in OnDraw()
DeleteDrawingObject Delete a drawing object
DeleteDrawingMaterial Delete a material for drawing objects
DeleteDrawingText Delete a drawing text
SetDrawProxyObject Set a draw proxy object
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 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 const char *MQStationPlugin::EnumSubCommand(int index);

index
An index of a sub command
Return value
A sub command's identifier string

It returns a name for a sub command which can be assigned a shortcut key.

This method is repeatedly called with an increment of index from 0. When the return value is NULL, an enumeration will be finished.

This method is declared as a virtual function, and no sub command is registered in MQStationPlugin. Please implement EnumSubCommand(), GetSubCommandString() and OnSubCommand() in an inheriting class if you want to sub command(s).

And when a button is registered by MQWidgetBase::RegisterSubCommandButton(), a shortcut key assigned to the sub command will be shown on the button.


virtual const wchar_t *MQStationPlugin::GetSubCommandString(int index);

index
An index of a sub command
Return value
A sub command's displayed string

It returns a displayed string of the sub command with the specified index.


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
A 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
A 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::OnSubCommand(MQDocument doc, int index);

doc
A document
index
An index of a sub command
Return value
[TRUE] Modified the document
[FALSE] Nothing is modified in the document

This method is called when a shortcut key assigned to a sub command returned by EnumSubCommand() is pressed.

This method is declared as a virtual function, and nothing is done in the MQStationPlugin. Please implement a procedure for a sub command in an inheriting class.


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

doc
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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
A 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.


virtual void MQStationPlugin::OnChangeEditOption(MQDocument doc, EDITOPTION_TYPE trigger);

doc
A document
trigger
A changed item
[EDITOPTION_SCREEN] Edit on a screen coordinate
[EDITOPTION_WORLD] Edit on a world coordinate
[EDITOPTION_LOCAL] Edit on a local coordinate

(new in Rev4.40)

This method is called when an edit option is changed.


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 bool MQStationPlugin::ExecuteCallback(MQDocument doc, void *option);

doc
A document
option
An arbitrary data given by BeginCallback()
Return value
[TRUE] Modified the document
[FALSE] Nothing is modified in the document
 

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
A 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
Return value
A created 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
A document
index
An index of the created material
instant
Whether to create as a temporal material
Return value
A created 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.


MQDrawingText MQStationPlugin::CreateDrawingText(MQDocument doc, const wchar_t *text, DRAWING_TEXT_PARAM& param, BOOL instant=TRUE);

doc
A document
text
A displayed string
param
Parameters for drawing
instant
Whether to create as a temporal text
Return value
A created text

(new in Rev4.50)

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

The text 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 DeleteDrawingText() when is becomes unnecessary or OnEndDocument() is called.

struct DRAWING_TEXT_PARAM {
    MQPoint ScreenPos;
    MQColor Color;
    float FontScale;
    DRAWING_TEXT_ALIGNMENT HorzAlign;
    DRAWING_TEXT_ALIGNMENT VertAlign;
};
ScreenPos
A position on a screen coordinate
Color
A displayed color
FontScale
A scaling rate of a font
HorzAlign
横方向の位置
[TEXT_ALIGN_LEFT] 左寄せ
[TEXT_ALIGN_CENTER] 中央
[TEXT_ALIGN_RIGHT] 右寄せ
VertAlign
縦方向の位置
[TEXT_ALIGN_TOP]
[TEXT_ALIGN_CENTER] 中央
[TEXT_ALIGN_RIGHT]

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

doc
A 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
A document
mat
A material for drawing objects

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


void MQStationPlugin::DeleteDrawingText(MQDocument doc, MQDrawingText text);

doc
A document
obj
A drawing text

(new in Rev4.50)

It deletes a text created by CreateDrawingText() which the 'instant' is FALSE.


void MQStationPlugin::SetDrawProxyObject(MQObject obj, MQObject proxy);

obj
An object
proxy
A draw proxy object (can be NULL)

(new in Rev4.30)

A "draw proxy object" is displayed instead of vertices, lines or faces in a normal object. The display is only alternated, and it does not affect each operation.

Usually, obj is specified an object in the document, and proxy is specified an object that is created by MQ_CreateObject() or CreateDrawingObject().

When you specify a draw proxy object that is created by CreateDrawingObject() with TRUE instant in the OnDraw(), the object is displayed only once and it is deleted automatically after calling OnDraw().

When you set FALSE to instant or used an object created by MQ_CreateObject(), the object is continuously displayed until deleting it or specifying another draw proxy object.。


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