Bool CSVNodeData::iGetPortDescription(GvNode* host, GvPortIO port, LONG id,
                                      GvPortDescription* desc) {
    Bool result = FALSE;
    for (LONG i=0; g_csvports[i].id != 0; i++) {
        const CSVPort& port = g_csvports[i];
        if (port.id == id) {
            desc->name = GeLoadString(port.id);
            desc->data_id = port.dtype;
            desc->flags = port.flags;
            result = TRUE;
            break;
        }
    }
    if (!result && id >= CSVNODE_DYNPORT_START && m_table.Loaded()) {
        LONG index = id - CSVNODE_DYNPORT_START;
        LONG colCount = m_table.GetColumnCount();
        if (index < colCount) {
            desc->name = GetTableColumnPortName(index);
            desc->data_id = DTYPE_STRING;
            desc->flags = GV_PORTDESCRIPTION_NONE;
            result = TRUE;
        }
        else {
            result = FALSE;
        }
    }
    if (!result) {
        desc->name = GeLoadString(IDC_CSVNODE_INVALIDPORT);
        desc->data_id = DTYPE_NONE;
    }
    return result;
}
Beispiel #2
0
Bool PluginStart()
{
  // RegisterAutoConnectObject();
  return RegisterCommandPlugin(
      ID_AUTOCONNECT_COMMAND,
      GeLoadString(IDS_AUTOCONNECT_NAME),
      PLUGINFLAG_COMMAND_HOTKEY,
      AutoBitmap("autoconnect.tif"),
      GeLoadString(IDS_AUTOCONNECT_HELP),
      new AutoConnectCommand);
}
String CSVNodeData::GetTableColumnPortName(LONG column) const {
    if (!m_table.Loaded() || column < 0) {
        return GeLoadString(IDC_CSVNODE_INVALIDPORT);
    }

    String prefix = GeLoadString(IDC_CSVNODE_TABLECOLUMN_PREFIX);
    const CSVRow& header = m_table.GetHeader();

    if (column < header.GetCount()) {
        return prefix + header[column];
    }
    else {
        return prefix + LongToString(column + 1);
    }
}
Beispiel #4
0
/*********************************************************************\
	Function name    : CDialogGroup::CDialogGroup
	Description      :
	Created at       : 12.08.01, @ 09:17:45
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
CDialogGroup::CDialogGroup(CDialogDoc* pDoc)
{
	m_strName = GeLoadString(IDS_GROUP);
	m_strDescr = m_strName;
	m_type = Group;
	m_lFlags = BFH_LEFT | BFV_TOP;
	m_lInitW = 0;
	m_lInitH = 0;

	m_lBorderStyle = BORDER_NONE;
	m_bHasTitleCheckbox = false;
	m_bHasBorder = true;
	m_bBorderNoTitle = 0;
	m_lCols = m_lRows = 1;
	m_lGroupFlags = 0;

	m_lTabType = TAB_TABS;

	m_lScrollType = SCROLLGROUP_VERT | SCROLLGROUP_HORIZ;

	m_lGroupType = 0; // simple (1 : tab, 2 : scroll, 3 : radio)

	m_lLeftBorder = m_lRightBorder = m_lTopBorder = m_lBottomBorder = 0;
	m_lSpaceX = m_lSpaceY = -1;

	m_pDocument = pDoc;
	m_strControlID = CreateControlID();

	m_lLastChildID = -1;
}
Beispiel #5
0
 Bool CreateLayout()
 {
   GroupBeginInMenuLine();
   {
     BaseContainer customdata;
     customdata.SetString(HYPERLINK_LINK_TEXT, GeLoadString(CMG_DEVLINK));
     customdata.SetString(HYPERLINK_LINK_DEST, GeLoadString(CMG_DEVLINK_LINK));
     customdata.SetBool(HYPERLINK_IS_LINK, true);
     customdata.SetBool(HYPERLINK_ALIGN_RIGHT, true);
     customdata.SetBool(HYPERLINK_NO_UNDERLINE, true);
     AddCustomGui(CMG_DEVLINK, CUSTOMGUI_HYPER_LINK_STATIC, "",
            0, 0, 0, customdata);
     GroupEnd();
   }
   return LoadDialogResource(DLG_MAIN, nullptr, BFH_SCALEFIT | BFV_SCALEFIT);
 }
/*********************************************************************\
	Function name    : CDialogCustomElement::CDialogCustomElement
	Description      :
	Created at       : 11.08.01, @ 17:19:05
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
CDialogCustomElement::CDialogCustomElement(CDialogDoc* pDoc)
{
    m_strName = GeLoadString(IDS_CUSTOM_ELEMENT);
    m_strDescr = m_strName;
    m_type = CustomElement;
    m_lFlags = BFH_LEFT | BFV_TOP;
    m_lInitW = 0;
    m_lInitH = 0;
    m_pDocument = pDoc;
    m_strControlID = CreateControlID();
    m_pbcGUI = nullptr;
    m_pData = nullptr;

    CreateElementList();
    if (g_pCustomElements)
    {
        m_lElement = (g_pCustomElements->Entries() > 0) ? 0 : -1;
        CCustomElements* pElement = g_pCustomElements->GetItem(m_lElement);
        m_strName += " [" + pElement->m_strName + "]";
        m_strDescr += " [" + pElement->m_strName + "]";
    }
    else
        m_lElement = -1;

    if (g_pCustomElements->Entries() > 0)
    {
        m_pbcGUI = bNewDeprecatedUseArraysInstead<BaseContainer>(g_pCustomElements->Entries());
        m_pData = bNewDeprecatedUseArraysInstead<TriState<GeData>>(g_pCustomElements->Entries());
    }
}
/*********************************************************************\
	Function name    : CCustomElementSettings::Command
	Description      :
	Created at       : 26.03.02, @ 13:18:45
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCustomElementSettings::Command(Int32 lID, const BaseContainer &msg)
{
    switch (lID)
    {
    case IDC_CUSTOM_GUI_LIST:
    {
        Int32 lItemID = msg.GetInt32(LV_SIMPLE_ITEM_ID);
        AutoAlloc<BaseSelect> pSel;
        m_wndListView.GetSelection(pSel);
        if (!pSel) break;
        if (!pSel->IsSelected(lItemID)) break;

        if (m_lLastID != lItemID)
        {
            m_pElement->m_lElement = lItemID;
            m_lLastID = lItemID;

            CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement);
            if (pElement)
            {
                m_pElement->m_strName = GeLoadString(IDS_CUSTOM_ELEMENT) + " [" + pElement->m_strName + "]";;
                m_pElement->SetDescr(m_pElement->m_strName);
                m_wndSubDlg.Refresh(m_pSettingsDialog, pElement->m_pProp, m_pElement);
            }
            m_pElement->ItemChanged();
            m_pElement->GetDocument()->UpdateAllViews(true, false);
        }
    }
    break;
    }
    return true;
}
Beispiel #8
0
/// ***************************************************************************
/// ***************************************************************************
Bool RegisterContainerObject(Bool menu)
{
  if (menu) {
    BaseContainer* menu = nullptr;
    FindMenuResource("M_EDITOR", "IDS_MENU_OBJECT", &menu);
    if (menu) {
      menu->InsData(MENURESOURCE_SEPERATOR, true);
      menu->InsData(MENURESOURCE_COMMAND, "PLUGIN_CMD_" + LongToString(Ocontainer));
    }
    return true;
  }

  _orig_GetInfo = C4DOS.Bo->GetInfo;
  C4DOS.Bo->GetInfo = _hook_GetInfo;

  AutoAlloc<BaseBitmap> bmp;
  bmp->Init(GeGetPluginPath() + "res" + "img" + "ocontainer.png");

  return RegisterObjectPlugin(
    Ocontainer,
    GeLoadString(IDS_OCONTAINER),
    OBJECT_GENERATOR,
    ContainerObject::Alloc,
    "Ocontainer",
    bmp,
    CONTAINEROBJECT_DISKLEVEL);
}
Bool RegisterCSVNode() {
    Bool ok = GvRegisterOperatorPlugin(
                  GvOperatorID(ID_CSVNODE),
                  GeLoadString(IDC_CSVNODE_NAME),
                  0,
                  CSVNodeData::Alloc,
                  "Gvcsv",
                  CSVNODE_VERSION,
                  ID_GV_OPCLASS_TYPE_GENERAL,
                  ID_GV_OPGROUP_TYPE_XPRESSOEFFECTOR,
                  0, // owner
                  AutoBitmap("Gvcsv.tif"));
    if (!ok) {
        GePrint(GeLoadString(IDC_CSVNODE_NOTREGISTERED));
    }
    return ok;
}
Beispiel #10
0
Bool LiquidToolData::GetCursorInfo(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, Float x, Float y, BaseContainer& bc)
{
	if (bc.GetId() == BFM_CURSORINFO_REMOVE)
		return true;

	bc.SetString(RESULT_BUBBLEHELP, GeLoadString(IDS_PRIMITIVETOOL));
	bc.SetInt32(RESULT_CURSOR, MOUSE_POINT_HAND);
	return true;
}
Beispiel #11
0
Bool RegisterBFF(void)
{
	String name = GeLoadString(IDS_BFF);
	if (!RegisterBitmapLoaderPlugin(ID_BFFLOADER, name, 0, NewObjClear(BFFLoaderData)))
		return false;
	if (!RegisterBitmapSaverPlugin(ID_BFFSAVER, name, PLUGINFLAG_BITMAPSAVER_SUPPORT_8BIT, NewObjClear(BFFSaverData), "bff"))
		return false;
	return true;
}
//----------------------------------------------------------------------------------------
// Register filter
// Function result:		true/false
//----------------------------------------------------------------------------------------
Bool RegisterSampleMatrix(void)
{
	String name = GeLoadString(IDS_MATRIX);
	if (!name.Content())
		return true;

	// be sure to use a unique ID obtained from www.plugincafe.com
	return GeRegisterPlugin(PLUGINTYPE_BITMAPFILTER, 1000690, name, &smpl_matrix_filter, sizeof(smpl_matrix_filter));
}
Beispiel #13
0
Bool ForceOpenFileWrite(BaseFile* pFile, const Filename &fn)
{
	if (pFile->Open(fn, FILEOPEN_WRITE))
		return true;
	String str = GeLoadString(IDS_WRITE_PROTECTION, fn.GetFileString());
	if (GeOutString(str, GEMB_ICONQUESTION | GEMB_YESNO) != GEMB_R_YES)
		return false;
	GeFKill(fn, GE_FKILL_FORCE);
	return pFile->Open(fn, FILEOPEN_WRITE);
}
Beispiel #14
0
/*********************************************************************\
	Function name    : CHelpMenu::Execute
	Description      :
	Created at       : 26.03.02, @ 11:41:38
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CHelpMenu::Execute(BaseDocument *doc)
{
	Filename fn = GeGetPluginPath();
	fn += Filename("Doc");
	fn += GeLoadString(IDS_HELP_FILE);

	GeExecuteFile(fn);

	return true;
}
Beispiel #15
0
/*********************************************************************\
	Function name    : CCompareTableDialog::CreateLayout
	Description      :
	Created at       : 09.10.01, @ 21:07:14
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCompareTableDialog::CreateLayout(void)
{
	SetTitle(GeLoadString(IDS_COMPARE_TABLE_CAPTION));

	GroupBegin(101, BFH_FIT, 0, 1, "", 0);
		//AddStaticText(201, BFH_LEFT, 0, 0, GeLoadString(IDS_ORIGINAL_TABLE), 0);
		AddListView(IDC_OUTPUT_LIST, BFH_FIT, 800, 300);
		//AddStaticText(202, BFH_LEFT, 0, 0, GeLoadString(IDS_NEW_TABLE), 0);
		//AddListView(IDC_NEW_LIST, BFH_FIT, 400, 10);
	GroupEnd();

	AddButton(IDS_SAVE_BTN, BFH_LEFT, 0, 0, GeLoadString(IDS_SAVE_RESULT));

	m_wndOutputList.AttachListView(this, IDC_OUTPUT_LIST);

	AddDlgGroup(DLG_OK | DLG_CANCEL);

	return true;
}
Beispiel #16
0
CDialogUserArea::CDialogUserArea(CDialogDoc* pDoc)
{
	m_strName = GeLoadString(IDS_USER_AREA);
	m_strDescr = m_strName;
	m_type = UserArea;
	m_lFlags = BFH_LEFT | BFV_TOP;
	m_lInitW = 100;
	m_lInitH = 100;
	m_pDocument = pDoc;
	m_strControlID = CreateControlID();
}
Beispiel #17
0
CDialogRadioBtn::CDialogRadioBtn(CDialogDoc* pDoc)
{
	m_strName = GeLoadString(IDS_RADIO_BTN);
	m_strDescr = m_strName;
	m_type = RadioBtn;
	m_lFlags = BFH_LEFT | BFV_TOP;
	m_lInitW = 0;
	m_lInitH = 0;

	m_bText = false;
	m_pDocument = pDoc;
	m_strControlID = CreateControlID();
}
Bool RegisterPaintBrushSculpt()
{
	SculptBrushParams *pParams = SculptBrushParams::Alloc();
	if (!pParams) return false;

	pParams->EnableInvertCheckbox(true);
	pParams->EnableBrushAccess(true);
	pParams->SetUndoType(SCULPTBRUSHDATATYPE_POINT);
	pParams->SetMovePointFunc(&SculptMovePointsFunc);

	String name = GeLoadString(IDS_PAINT_BRUSH_SCULPT); if (!name.Content()) return true;
	return RegisterToolPlugin(ID_PAINT_BRUSH_SCULPT, name, PLUGINFLAG_TOOL_SCULPTBRUSH|PLUGINFLAG_TOOL_NO_OBJECTOUTLINE, nullptr, GeLoadString(IDS_PAINT_BRUSH_SCULPT_HELP), NewObjClear(PaintBrushSculpt, pParams));
}
Beispiel #19
0
  /// Called from Message() for MSG_EDIT (when a user double-clicks
  /// the object icon). Toggles the protection state of the container.
  void ToggleProtect(BaseObject* op)
  {
    BaseDocument* doc = op->GetDocument();
    if (doc)
    {
      doc->StartUndo();
      doc->AddUndo(UNDOTYPE_CHANGE_SMALL, op);
      doc->EndUndo();
    }

    BaseContainer const* bc = op->GetDataInstance();
    if (!bc) return;

    if (!m_protected)
    {
      String password;
      if (!PasswordDialog(&password, false, true)) return;
      String hashed = HashString(password);
      m_protected = true;
      m_protectionHash = hashed;

      HideNodes(op, doc, true);
    }
    else
    {
      String password;
      Bool unlock = false;
      String emptyPassHash = HashString("");
      if (m_protectionHash == emptyPassHash)
      {
        unlock = true;
      }
      else if (PasswordDialog(&password, true, true))
      {
        unlock = (m_protectionHash == HashString(password));
        if (!unlock)
          MessageDialog(GeLoadString(IDS_PASSWORD_INVALID));
      }
      if (unlock)
      {
        m_protected = false;
        HideNodes(op, doc, false);
      }
    }

    op->Message(MSG_CHANGE);
    op->SetDirty(DIRTYFLAGS_DESCRIPTION);
    EventAdd();
  }
Beispiel #20
0
/*********************************************************************\
	Function name    : CDialogArrowBtn::CDialogArrowBtn
	Description      :
	Created at       : 12.08.01, @ 21:52:38
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
CDialogArrowBtn::CDialogArrowBtn(CDialogDoc* pDoc)
{
	m_strName = GeLoadString(IDS_ARROW);
	m_strDescr = m_strName;
	m_type = ArrowBtn;
	m_lFlags = BFH_LEFT | BFV_TOP;
	m_lInitW = 0;
	m_lInitH = 0;
	m_lArrowType = ARROW_LEFT;
	m_bIsPopupButton = false;
//  m_lChildren = 0;
//  m_pstrChildren = nullptr;
//  m_plChildIDs = nullptr;
	m_pDocument = pDoc;
	m_strControlID = CreateControlID();
}
Beispiel #21
0
Bool RegisterGradient(void)
{
	Filename fn = GeGetPluginPath()+"res"+"gradienttypes.tif";
	AutoAlloc<BaseBitmap> bmp;
	if (IMAGERESULT_OK!=bmp->Init(fn)) return FALSE;

	RegisterIcon(200000135,bmp,0*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000136,bmp,1*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000137,bmp,2*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000138,bmp,3*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000139,bmp,4*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000140,bmp,5*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000141,bmp,6*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000142,bmp,7*32,0,32,32,ICONFLAG_COPY);

	// be sure to use a unique ID obtained from www.plugincafe.com
	return RegisterShaderPlugin(1001161,GeLoadString(IDS_SDKGRADIENT),0,SDKGradientClass::Alloc,"Xsdkgradient",0);
}
Beispiel #22
0
/*********************************************************************\
	Function name    : CDialogPreview::Update
	Description      :
	Created at       : 11.08.01, @ 15:09:59
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CDialogPreview::Update()
{
	CDialogTemplate* pTempl = m_pDocument->GetDialog();
	if (!pTempl) return;

	m_wndSubDlg.SetDialog(this, pTempl);

	AttachSubDialog(&m_wndSubDlg, IDC_PREVIEW_SUB_DLG);
	LayoutChanged(IDC_PREVIEW_SUB_DLG);

	String strFile = m_pDocument->UpdateDialogCaptions();

	String strCaption = pTempl->m_strName;
	strCaption += "  [";
	strCaption += GeLoadString(IDS_RES_EDIT_PREVIEW_CAPT) + " - " + strFile;
	strCaption += "]";
	SetTitle(strCaption);
}
Beispiel #23
0
/*********************************************************************\
	Function name    : CResEditBrowser::CreateLayout
	Description      :
	Created at       : 25.09.01, @ 22:33:40
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CResEditBrowser::CreateLayout(void)
{
	GroupBeginInMenuLine();
	AddButton(IDC_BROWSE_BUTTON, BFH_LEFT, 0, 0, GeLoadString(IDS_BROWSE));
	GroupEnd();

	GroupBegin(101, BFH_SCALEFIT | BFV_SCALEFIT, 1, 0, "", 0);
	if (!m_wndTreeView.CreateTreeView(IDC_DIRECTORY_TREE, this, NOTOK, nullptr,
			TREE_ITEM_SAME_HEIGHT, BFH_SCALEFIT | BFV_SCALEFIT))
		return false;

	GroupEnd();

	/*m_wndListView.AttachListView(this, IDC_FILE_LIST);


	BaseContainer bc;
	bc.SetInt32('name', LV_COLUMN_TEXT);
	m_wndListView.SetLayout(1, bc);*/
	return true;
}
Bool RegisterSculptSelectionBrush()
{
	SculptBrushParams* pParams = SculptBrushParams::Alloc();
	if (!pParams)
		return false;

	//Since we are using StartStroke/EndStroke calls then we need to set this to true.
	pParams->EnableBrushAccess(true);

	//We want to handle undo/redo ourselves so we tell the Sculpting System that should not do anything with its Undo System.
	pParams->SetUndoType(SCULPTBRUSHDATATYPE_NONE);

	//Tell the system to only rebuild the collision cache if something other than the select flags have changed
	pParams->SetPolygonObjectDirtyFlags(DIRTYFLAGS_ALL & ~DIRTYFLAGS_SELECT);

	//Set the MovePointFunc to call for each dab.
	pParams->SetMovePointFunc(&SculptSelectionBrush::MovePointsFunc);

	//Register the tool with Cinema4D.
	return RegisterToolPlugin(SCULPTBRUSH_SDK_EXAMPLE_SELECTION, GeLoadString(IDS_SCULPTBRUSH_SELECTIONTOOL), PLUGINFLAG_TOOL_SCULPTBRUSH | PLUGINFLAG_TOOL_NO_OBJECTOUTLINE, nullptr, GeLoadString(IDS_SCULPTBRUSH_SELECTIONTOOL), NewObjClear(SculptSelectionBrush, pParams));
}
/*********************************************************************\
	Function name    : CDialogCustomElement::Load
	Description      :
	Created at       : 27.03.02, @ 14:54:02
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CDialogCustomElement::Load(BaseContainer* bc)
{
    Int32 lPlugID = bc->GetInt32(DROLDWIN_SDK);
    BasePlugin *bs = (BasePlugin*)FindPlugin(lPlugID, PLUGINTYPE_CUSTOMGUI);

    CDialogItem::Load(bc);

    // check out, which element this is in our list
    if (!bs) return true;

    CCustomElements* pFirst = (CCustomElements*)g_pCustomElements->First();
    Int32 lElement = 0;
    Bool bFound = false;
    while (pFirst)
    {
        if (pFirst->m_lID == lPlugID) {
            bFound = true;
            break;
        }
        pFirst = (CCustomElements*)g_pCustomElements->Next(pFirst);
        lElement++;
    }
    if (!bFound) return true;

    m_lElement = lElement;
    BaseContainer* pBC = &m_pbcGUI[m_lElement];
    *pBC = *bc;

    if (bc->GetBool(DR_CUSTOMGUI_OPEN))
        pFirst->m_bIsOpen = true;

    CCustomElements* pElement = g_pCustomElements->GetItem(m_lElement);
    m_strName = GeLoadString(IDS_CUSTOM_ELEMENT);
    m_strName += " [" + pElement->m_strName + "]";
    m_strDescr = m_strName;

    return true;
}
Beispiel #26
0
Bool RegisterSculptGrabBrush()
{
	SculptBrushParams* pParams = SculptBrushParams::Alloc();
	if (!pParams)
		return false;

	//Tell the system that its a grab brush. This means that on mouse down it will grab the selected vertices that are under the brush and
	//then during the entire mouse movement it will only affect those points.
	//If this was set to SCULPTBRUSHMODE_NORMAL then it would select new points every time the brush moves.
	pParams->SetBrushMode(SCULPTBRUSHMODE_GRAB);

	//Hide the pressure value from the HUD when the middle mouse button is pressed or ctrl+shift is held down.
	pParams->EnablePressureHUD(false);

	//This tells the system that the brush is going to be adjusting the points on the layer so it should setup the undo system for points.
	pParams->SetUndoType(SCULPTBRUSHDATATYPE_POINT);

	//Pass in the pointer to the static MovePointsFunc. This will get called for every dab.
	pParams->SetMovePointFunc(&ExampleSculptGrabBrush::MovePointsFunc);

	//Register the tool with Cinema4D.
	return RegisterToolPlugin(SCULPTGRABBRUSH_SDK_EXAMPLE, GeLoadString(IDS_SCULPTGRABBRUSH_TOOL), PLUGINFLAG_TOOL_SCULPTBRUSH | PLUGINFLAG_TOOL_NO_OBJECTOUTLINE, nullptr, GeLoadString(IDS_SCULPTGRABBRUSH_TOOL), NewObjClear(ExampleSculptGrabBrush, pParams));
}
//----------------------------------------------------------------------------------------
// Apply the effect to the whole bitmap and update the document view (if indicated)
// Function result:		FILTER_OK or error code
// bm:								bitmap reference
// src_rect:					requested source rectangle
// dt:								pointer of the preview destination tile or 0 (apply effect to the mask_rect area)
// settings:					private filter settings
// update_view:				true: call BfUpdateView() for processed tiles
// thread:						pointer to thread class (0: no thread)
//----------------------------------------------------------------------------------------
static Int32 apply_effect(BM_REF bm, const RECT32* src_rect, BM_TILE* dt, BM_FILTER_SETTINGS* t_settings, Bool update_view, BaseThread* thread)
{
	PRIVATE_SETTINGS* settings = (PRIVATE_SETTINGS*)t_settings;
	Int32	err;

	err = FILTER_OK;

	if (src_rect == 0)
		src_rect = &bm->mask_rect;

	if (settings->emr_lock->Lock(thread))	// lock the semaphore for the effect matrix
	{
		if (settings->emr == 0)							// effect matrix not initialized?
		{
			if (change_effect_matrix(settings, bm) == false)
				err = FILTER_MEM_ERR;
		}
		else
		{
			update_effect_matrix(settings->emr, bm->image_color_space, bm->image_px_format);	// update settings in case bitmap has changed

		}
		settings->emr_lock->Unlock();
	}
	else	// stop thread
	{
		err = FILTER_ABORT;
	}

	if (err == FILTER_OK)
	{
		if (dt)
		{
			BM_TILE	 tmp;
			BM_TILE* scratch;
			Bool		 scale;
			Int32		 width;
			Int32		 height;

			width	 = dt->xmax - dt->xmin;
			height = dt->ymax - dt->ymin;

			if ((width != src_rect->x2 - src_rect->x1) && (height != src_rect->y2 - src_rect->y1))
			{
				scale = true;	// in this case we have to post-scale the result of the matrix
				scratch = BfBitmapTileGet(bm, src_rect, 0, 0, TILE_BM_SCRATCH, 0);
				if (scratch == 0)
					return FILTER_MEM_ERR;
			}
			else
			{
				scale = false;
				tmp = *dt;
				tmp.xmin = src_rect->x1;	// make sure the effect gets the same source and tile rect
				tmp.ymin = src_rect->y1;
				tmp.xmax = src_rect->x2;
				tmp.ymax = src_rect->y2;
				scratch	 = &tmp;
			}

			err = do_matrix_effect_1dt(bm, scratch, settings->emr, settings->tile_flags);
			if (scale)
			{
				if (err == FILTER_OK)
				{
					if (BfBitmapTileScale(bm, scratch, dt, (RECT32*) &scratch->xmin, (RECT32*) &dt->xmin) == false)
						err = FILTER_MEM_ERR;
				}
				BfBitmapTileDetach(bm, scratch, false);
			}
		}
		else
		{
			String apply_filter_str;

			apply_filter_str = GeLoadString(IDS_APPLY_FILTER);
			err = do_matrix_effect(bm, settings->emr, thread, settings->tile_flags, update_view, &apply_filter_str);
		}
	}
	return err;
}
Beispiel #28
0
Bool DiffDistriDialog::Command(Int32 id, const BaseContainer &msg)
{
	switch (id)
	{
	case IDC_DIFF_DISTRI_NEW_BTN:
		{
			Filename fn;
			if (fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_LOAD, GeLoadString(IDS_DIFF_DISTRI_CHOOSE)))
			{
				if (!fn.CheckSuffix("zip"))
				{
					GeOutString(GeLoadString(IDS_DIFF_DISTRI_INVALID_SUFFIX), GEMB_OK | GEMB_ICONSTOP);
				}
				else
				{
					g_pResEditPrefs->arOldFiles.AddFilename(fn);
					m_pTreeView->Refresh();
				}
			}
		}
		break;

	case IDC_DIFF_DISTRI_REMOVE_BTN:
		if (m_fnSelection.Content())
		{
			g_pResEditPrefs->arOldFiles.RemoveFilename(m_fnSelection);
			m_fnSelection = Filename();
			m_pTreeView->Refresh();
		}
		break;

	case IDC_DIFF_DISTRI_NEWZIP_EDIT:
		g_pResEditPrefs->fnNewZip = m_pNewZipEdit->GetData().GetValue().GetFilename();
		break;

	case IDC_DIFF_DISTRI_DESTPATH_EDIT:
		{
			Filename fnDestZip = m_pDestPathEdit->GetData().GetValue().GetFilename();
			g_pResEditPrefs->fnDestZip = fnDestZip;
			g_pResEditPrefs->fnDestZip.SetSuffix("zip");
			if (fnDestZip.Content() && g_pResEditPrefs->fnDestZip != fnDestZip)
				m_pDestPathEdit->SetData(TriState<GeData>(g_pResEditPrefs->fnDestZip));
		}
		break;

	case IDC_OK:
		{
			GeData d;
			String strPassword;
			Int32 lLen = 0;
			char* pchPassword = nullptr;

			Filename fnDestZip = m_pDestPathEdit->GetData().GetValue().GetFilename();
			g_pResEditPrefs->fnNewZip = m_pNewZipEdit->GetData().GetValue().GetFilename();
			g_pResEditPrefs->fnDestZip = fnDestZip;
			g_pResEditPrefs->fnDestZip.SetSuffix("zip");
			if (fnDestZip.Content() && g_pResEditPrefs->fnDestZip != fnDestZip)
				m_pDestPathEdit->SetData(TriState<GeData>(g_pResEditPrefs->fnDestZip));
			GetString(IDC_DIFF_DISTRI_PASSWORD_EDIT, strPassword);

			lLen = strPassword.GetCStringLen(STRINGENCODING_8BIT);
			if (lLen)
			{
				pchPassword = NewMemClear(Char,lLen + 2);
				if (pchPassword)
					strPassword.GetCString(pchPassword, lLen + 1, STRINGENCODING_8BIT);
			}

			if (!g_pResEditPrefs->arOldFiles.GetElementCount())
			{
				GeOutString(GeLoadString(IDS_DIFF_DISTRI_NO_OLD), GEMB_ICONSTOP);
				DeleteMem(pchPassword);
				break;
			}
			if (!g_pResEditPrefs->fnNewZip.Content())
			{
				GeOutString(GeLoadString(IDS_DIFF_DISTRI_NO_NEW), GEMB_ICONSTOP);
				DeleteMem(pchPassword);
				break;
			}
			if (!g_pResEditPrefs->fnDestZip.Content())
			{
				GeOutString(GeLoadString(IDS_DIFF_DISTRI_NO_DEST), GEMB_ICONSTOP);
				DeleteMem(pchPassword);
				break;
			}

			if (!DiffZipFiles(g_pResEditPrefs->arOldFiles, g_pResEditPrefs->fnNewZip, g_pResEditPrefs->fnDestZip, pchPassword))
				GeOutString(GeLoadString(IDS_DIFF_DISTRI_FAILED, g_pResEditPrefs->fnNewZip.GetString(), g_pResEditPrefs->fnDestZip.GetString()), GEMB_OK | GEMB_ICONEXCLAMATION);
			DeleteMem(pchPassword);
		}
		break;

	case IDC_CANCEL:
		Close();
		break;

	default:
		break;
	}

	return true;
}
Beispiel #29
0
Bool RegisterDeformerObject()
{
	return RegisterObjectPlugin(ID_HAIR_DEFOMER_EXAMPLE,GeLoadString(IDS_HAIR_DEFOMER_EXAMPLE),OBJECT_MODIFIER,HairDeformerObject::Alloc,"Ohairsdkdeformer",AutoBitmap("hairdeformer.tif"),0);
}
Beispiel #30
0
Bool RegisterDiffZipCommand()
{
	RegisterResEditIcon(DIFF_DISTRI_ID, 8, 2);
	RegisterCommandPlugin(DIFF_DISTRI_ID, GeLoadString(IDS_DIFF_DISTRI), 0, nullptr, GeLoadString(IDS_DIFF_DISTRI), NewObjClear(DiffDistriCommand));
	return true;
}