Global function

Global functions are provided to operate an information about the system or to create new classes.


HWND MQ_GetWindowHandle(void);

Return value
A window handle

It gets a handle of the main window. It is necessary, for example, to create a dialog box.

(in Rev4.00)

This function is deprecated now. It will be obsoleted in the future version. Please use MQWidgetBase::GetSystemWidgetID() to access widgets.


MQObject MQ_CreateObject(void);

Return value
A created object class

It creates a new object class. The created object must be registered to a document by MQDocument::AddObject(), or be deleted by MQObject::DeleteThis().


MQMaterial MQ_CreateMaterial(void);

Return value
A created material class

It creates a new material class. The created material must be registered to a document by MQDocument::AddMaterial(), or be deleted by MQMaterial::DeleteThis().


void MQ_ShowFileDialog(const char *title, MQFileDialogInfo *info);

It shows a file dialog with functions such as a conversion of coordinate axes.

'info' must be filled by 0 at the beginning, and set a size of this structure to 'dwSize'.

struct MQFileDialogInfo {
	enum HAND_TYPE {
		HAND_LEFT = 0,
		HAND_RIGHT = 1,
	};

	DWORD dwSize;
	int type;
	float scale;
	const char *softname;
	int axis_x;
	int axis_y;
	int axis_z;
	BOOL invert_face;
	HAND_TYPE hand_type;
	void (*dialog_callback)(bool init, MQFileDialogCallbackParam *param, void *ptr);
	void *dialog_callback_ptr;
	BOOL background;
	void *option_args;
};
dwSize
A size of this structure
hidden_flag (new in Rev4.00)
Hidden components. (multiple selection)
[HIDDEN_SCALE] Scaling
[HIDDEN_AXIS] Direction for each axis
[HIDDEN_INVERT_FACE] Invert faces
scale
A scaling factor for an initial value and used by MQ_ImportAxis/MQ_ExportAxis
softname
Software name matched with axes (defined in AxisInfo.txt)
axis_x
A direction of the X axis
[MQFILE_TYPE_LEFT] Left
[MQFILE_TYPE_RIGHT] Right
[MQFILE_TYPE_UP] Up
[MQFILE_TYPE_DOWN] Down
[MQFILE_TYPE_FRONT] Front
[MQFILE_TYPE_BACK] Back
axis_y
A direction of the Y axis (The selectable value is same as X axis.)
axis_z
A direction of the Z axis (The selectable value is same as X axis.)
invert_face (new in Rev4.00)
Flag for inverting faces
hand_type (new in Rev4.00)
Right hand coordinate, or left hand coordinate
dialog_callback (new in Rev4.00)
A callback function called before showing a dialog and after closing
dialog_callback_ptr (new in Rev4.00)
An arbitrary argument for a callback
background (new in Rev4.20)
A background processing (Store a return value of MQImportPlugin::IsBackground())
option_args (new in Rev4.20)
Import options (Store a return value of MQImportPlugin::GetImportOptions())

(in Rev4.00)

The left and right directions by axis_x, axis_y and axis_z in MQFileDialogInfo have been fixed because they are reversed. You should reverse MQFILE_TYPE_LEFT and MQFILE_TYPE_RIGHT if you want to get same results with transfering codes from old versions.


void MQ_ImportAxis(MQFileDialogInfo *info, MQPoint *pts, int pts_count);
void MQ_ExportAxis(MQFileDialogInfo *info, MQPoint *pts, int pts_count);

It converts positions based on the axes information set by a file dialog.

Each function is provided for importing and exporting.

(in Rev4.00)

The left and right directions by axis_x, axis_y and axis_z in MQFileDialogInfo have been fixed because they are reversed. You should reverse MQFILE_TYPE_LEFT and MQFILE_TYPE_RIGHT if you want to get same results with transfering codes from old versions.


BOOL MQ_LoadImage(const char *filename, LPVOID *header, LPVOID *buffer, DWORD reserved);

filename
A filename
header
A pointer to receive a header information of the DIB.
buffer
A pointer to receive a buffer of the DIB.
reserved
Reserved for the future version (must be 0)
Return value
[TRUE] Succeeded to load
[FALSE] Failed to load

(new in Rev2.10)

It loads the specified image file as a DIB (Device Independent Bitmap).

The heap memories allocated by LocalAlloc(LMEM_FIXED, uBytes) are stored to the 'header' and the 'buffer' if the loading has been succeeded. You must release the memory with LocalFree() when no longer needed.

BITMAPINFOHEADER structure (and RGBQUAD if bpp is 8 or lesse) is contained in header.

An image data is contained in buffer. If bpp is 32, the high byte means an alpha component.


BOOL MQ_GetSystemPath(char *buffer, int type);

buffer
A buffer to receive a path.
type
[MQFOLDER_ROOT] A folder contains Metaseq.exe (Ex: "C:\Program Files\Metaseq")
[MQFOLDER_METASEQ_EXE] A path of Metaseq.exe (Ex: "C:\Program Files\Metaseq\Metaseq.exe")
[MQFOLDER_METASEQ_INI] A path of Metaseq.ini (Ex: "C:\Program Files\Metaseq\Metaseq.ini") Obsoleted.
[MQFOLDER_DATA] Data folder (Ex: "C:\Program Files\Metaseq\Data")
[MQFOLDER_PLUGINS] Plugins folder (Ex: "C:\Program Files\Metaseq\Plugins")
[MQFOLDER_METASEQ_SETTING_XML] A path of Metaseq.setting.xml (Ex: "C:\Program Files\Metaseq\Metaseq.setting.xml")
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev2.10)

It stores the specified path to the 'buffer'. The size of the 'buffer' must be same as or larger than.

(obsolete in Rev4.00)

MQFOLDER_METASEQ_INI is no longer available. Please use MQFOLDER_METASEQ_SETTING_XML to access settings.

Attention: When MQFOLDER_DATA or MQFOLDER_PLUGINS is specified for 'type', an invalid directory is returned in Ver2.1.5 or older for the bug.


void MQ_RefreshView(void *reserved);

reserved
Reserved (must be NULL)

(new in Rev2.30)

It draws the view again.

The 'reserved' must be NULL.


void MQ_StationCallback(MQStationCallbackProc proc, void *option);

proc
A callback function
option
An option to give the callback function

(new in Rev2.40)

You call this function to do with an operation from a station plug-in, and perform the operation to a document in the callback function.

A callback function is defined with the following form:

typedef BOOL (__stdcall *MQStationCallbackProc)(MQDocument doc, void *option);

doc
A document
option
An option given by MQ_StationCallback()
Return value
[TRUE] Any change made
[FALSE] No change

BOOL MQ_SendMessage(int message_type, MQSendMessageInfo *info);

message_type
A message type
[MQMESSAGE_ACTIVATE] Change an active state
[MQMESSAGE_NEW_DRAW_OBJECT] Create a drawing object
[MQMESSAGE_NEW_DRAW_MATERIAL] Create a material for a drawing object
[MQMESSAGE_GET_UNDO_STATE] Get an undo state
info
An information
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev2.40)

It notifies a message to the main part of Metasequoia when a station plug-in does with an operation or requires an operation.


BOOL MQWidget_Value(int widget_id, int type_id, void *values);

widget_id
A widget ID to notify
messages
type_id
Message type ID
values
Options
戻り値
[TRUE] Modified
[FALSE] change

(new in Rev4.00)

It operates widgets and events.

It is not necessary to call this function directly. It is called by MQWidgetBase class and inherited classes.