Beispiel #1
0
static void ShowGroove(int flags, void *data)
{
    GrooveTemplateHandler *me = GrooveTemplateHandler::Instance();
    if(me->isGrooveEmpty())
    {
        MessageBox(GetMainHwnd(), __LOCALIZE("No groove loaded!","sws_mbox"), __LOCALIZE("FNG - Error","sws_mbox"),0);
        return;
    }
    MessageBox(GetMainHwnd(), me->GrooveToString().c_str(), __LOCALIZE("Groove","sws_mbox"), 0);
}
Beispiel #2
0
void GrooveDialog::ApplySelectedGroove()
{
    int index = (int)SendDlgItemMessage(m_hwnd, IDC_GROOVELIST, LB_GETCURSEL, 0, 0);
    std::string grooveName = __LOCALIZE("** User Groove **","sws_DLG_157");
    GrooveTemplateMemento memento = GrooveTemplateHandler::GetMemento();

    if(index > 0) {
        std::string itemLocation;
        char itemText[MAX_PATH];
        SendDlgItemMessage(m_hwnd, IDC_GROOVELIST, LB_GETTEXT, index, (LPARAM)itemText);
        grooveName = itemText;
        itemLocation = currentDir;
        itemLocation += PATH_SEP;
        itemLocation += grooveName;
        itemLocation += ".rgt";


        GrooveTemplateHandler *me = GrooveTemplateHandler::Instance();

        std::string errMessage;
        if(!me->LoadGroove(itemLocation, errMessage))
            MessageBox(GetMainHwnd(), errMessage.c_str(), __LOCALIZE("FNG - Error","sws_DLG_157"), 0);
    }
    if(index >= 0) {

        GrooveTemplateHandler *me = GrooveTemplateHandler::Instance();
        int beatDivider = me->GetGrooveTolerance();

        bool midiEditorTarget = SendDlgItemMessage(m_hwnd, IDC_TARG_NOTES, BM_GETCHECK, 0, 0) == BST_CHECKED;

        HWND editControl = GetDlgItem(m_hwnd, IDC_STRENGTH);
        char percentage[16];
        GetWindowText(editControl, percentage, 16);
        double posStrength = (double)atoi(percentage) / 100.0;
        editControl = GetDlgItem(m_hwnd, IDC_VELSTRENGTH);
        GetWindowText(editControl, percentage, 16);
        double velStrength = (double)atoi(percentage) / 100.0;
        std::string undoMessage = __LOCALIZE("FNG: load and apply groove - ","sws_DLG_157") + grooveName;

        try {
            if(midiEditorTarget)
                me->ApplyGrooveToMidiEditor(beatDivider, posStrength, velStrength);
            else
                me->ApplyGroove(beatDivider, posStrength, velStrength);
            Undo_OnStateChange2(0, undoMessage.c_str());
        } catch(RprLibException &e) {
            if(e.notify()) {
                MessageBox(GetMainHwnd(), e.what(), __LOCALIZE("FNG - Error","sws_DLG_157"), 0);
            }
        }
    }
    GrooveTemplateHandler::SetMemento(memento);
}
Beispiel #3
0
REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t *rec)
{
  g_hInst=hInstance;
  if (rec)
  {
    if (rec->caller_version != REAPER_PLUGIN_VERSION || !rec->GetFunc)
      return 0;

    *((void **)&InsertMedia) = rec->GetFunc("InsertMedia");
    *((void **)&GetMainHwnd) = rec->GetFunc("GetMainHwnd");
    *((void **)&GetProjectPath) = rec->GetFunc("GetProjectPath");
    

    
    if (!InsertMedia || !GetMainHwnd||!GetProjectPath) return 0;
    acreg.accel.cmd = g_registered_command = rec->Register("command_id",(void*)"NINJAMLOOP");

    if (!g_registered_command) return 0; // failed getting a command id, fail!

    rec->Register("gaccel",&acreg);
    rec->Register("hookcommand",(void*)hookCommandProc);


    g_parent = GetMainHwnd();

    HMENU hMenu = GetSubMenu(GetMenu(GetMainHwnd()),
#ifdef _WIN32
							 5
#else // OS X has one extra menu
							 6
#endif
	  );
    MENUITEMINFO mi={sizeof(MENUITEMINFO),};
    mi.fMask = MIIM_TYPE | MIIM_ID;
    mi.fType = MFT_STRING;
    mi.dwTypeData = "Insert random NINJAM loop";
    mi.wID = g_registered_command;
    InsertMenuItem(hMenu, 6, TRUE, &mi); 

    // our plugin registered, return success

    return 1;
  }
  else
  {
    return 0;
  }
}
Beispiel #4
0
void SetProjectStartupAction(COMMAND_T* _ct)
{
	if (PromptClearProjectStartupAction(false) == IDNO)
		return;

	char idstr[SNM_MAX_ACTION_CUSTID_LEN];
	lstrcpyn(idstr, __LOCALIZE("Paste command ID or identifier string here","sws_mbox"), sizeof(idstr));
	if (PromptUserForString(GetMainHwnd(), SWS_CMD_SHORTNAME(_ct), idstr, sizeof(idstr), true))
	{
		WDL_FastString msg;
		if (int cmdId = SNM_NamedCommandLookup(idstr))
		{
			// more checks: http://forum.cockos.com/showpost.php?p=1252206&postcount=1618
			if (int tstNum = CheckSwsMacroScriptNumCustomId(idstr))
			{
				msg.SetFormatted(256, __LOCALIZE_VERFMT("%s failed: unreliable command ID '%s'!","sws_DLG_161"), SWS_CMD_SHORTNAME(_ct), idstr);
				msg.Append("\n");

				// localization note: msgs shared with the CA editor
				if (tstNum==-1)
					msg.Append(__LOCALIZE("For SWS/S&M actions, you must use identifier strings (e.g. _SWS_ABOUT), not command IDs (e.g. 47145).\nTip: to copy such identifiers, right-click the action in the Actions window > Copy selected action cmdID/identifier string.","sws_mbox"));
				else if (tstNum==-2)
					msg.Append(__LOCALIZE("For macros/scripts, you must use identifier strings (e.g. _f506bc780a0ab34b8fdedb67ed5d3649), not command IDs (e.g. 47145).\nTip: to copy such identifiers, right-click the macro/script in the Actions window > Copy selected action cmdID/identifier string.","sws_mbox"));
				MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Error","sws_DLG_161"), MB_OK);
			}
			else
			{
				g_prjActions.Get()->Set(idstr);
				Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_MISCCFG, -1);

				msg.SetFormatted(256, __LOCALIZE_VERFMT("'%s' is defined as project startup action","sws_mbox"), kbd_getTextFromCmd(cmdId, NULL));
				char prjFn[SNM_MAX_PATH] = "";
				EnumProjects(-1, prjFn, sizeof(prjFn));
				if (*prjFn) {
					msg.Append("\n");
					msg.AppendFormatted(SNM_MAX_PATH, __LOCALIZE_VERFMT("for %s","sws_mbox"), prjFn);
				}
				msg.Append(".");
				MessageBox(GetMainHwnd(), msg.Get(), SWS_CMD_SHORTNAME(_ct), MB_OK);
			}
		}
		else
		{
			msg.SetFormatted(256, __LOCALIZE_VERFMT("%s failed: command ID or identifier string '%s' not found in the 'Main' section of the action list!","sws_DLG_161"), SWS_CMD_SHORTNAME(_ct), idstr);
			MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Error","sws_DLG_161"), MB_OK);
		}
	}
}
Beispiel #5
0
LRESULT CPageDesignerApp::OnSetTool(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	m_activeTool = wID;

	switch (wID)
	{
	case ID_TOOL_SELECT:
	case ID_TOOL_DIRECT:
		m_activeSelectionTool = wID;
		break;

	case ID_TOOL_TWIRL:
	case ID_TOOL_BULGE:
		{
			if (wNotifyCode == BN_DBLCLK)
			{
				CPropertySheet* sheet = new CPropertySheet("Tool", 0, GetMainHwnd());

				CBrushDimensionsDlg	brush;
				brush.m_brushSettings = this;
				sheet->AddPage(brush);

				sheet->DoModal();
			}
		}
		break;
	}

	FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);

	return 0;
}
Beispiel #6
0
void ShowStartupActions(COMMAND_T* _ct)
{
	WDL_FastString msg(__LOCALIZE("No project startup action is defined","sws_startup_action"));
	if (int cmdId = SNM_NamedCommandLookup(g_prjActions.Get()->Get()))
		msg.SetFormatted(512, __LOCALIZE_VERFMT("'%s' is defined as project startup action", "sws_startup_action"), kbd_getTextFromCmd(cmdId, NULL));

	char prjFn[SNM_MAX_PATH] = "";
	EnumProjects(-1, prjFn, sizeof(prjFn));
	if (*prjFn)
	{
		msg.Append("\r\n");
		msg.AppendFormatted(SNM_MAX_PATH, __LOCALIZE_VERFMT("for %s", "sws_startup_action"), prjFn);
	}
	msg.Append(".");
	msg.Append("\r\n\r\n");

	if (int cmdId = SNM_NamedCommandLookup(g_globalAction.Get()))
	{
		msg.AppendFormatted(512, __LOCALIZE_VERFMT("'%s' is defined as global startup action", "sws_startup_action"), kbd_getTextFromCmd(cmdId, NULL));
	}
	else
	{
		msg.Append(__LOCALIZE("No global startup action is defined","sws_startup_action"));
	}
	msg.Append(".");

	MessageBox(GetMainHwnd(), msg.Get(), SWS_CMD_SHORTNAME(_ct), MB_OK);
}
Beispiel #7
0
int EditBookMark(void)
{
	int Sts;

	Sts = DialogBox(GetFtpInst(), MAKEINTRESOURCE(bmark_dlg), GetMainHwnd(), EditBookMarkProc);
	return(Sts);
}
Beispiel #8
0
LRESULT CPageDesignerApp::OnAbout(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	CAboutDlg dlg;
	dlg.DoModal(GetMainHwnd());

	return 0;
}
Beispiel #9
0
void SaveBookMark(void)
{
	HMENU hMenu;
	MENUITEMINFO mInfo;
	int i;
	int Cnt;
	char *Buf;
	char *Pos;
	int Len;
	char Tmp[BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN + 1];
	int CurHost;

	if(AskConnecting() == YES)
	{
		if((CurHost = AskCurrentHost()) != HOSTNUM_NOENTRY)
		{
			if((Buf = malloc(BOOKMARK_SIZE)) != NULL)
			{
				hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);

				Pos = Buf;
				Len = 0;
				Cnt = GetMenuItemCount(hMenu);
				for(i = DEFAULT_BMARK_ITEM; i < Cnt; i++)
				{
					mInfo.cbSize = sizeof(MENUITEMINFO);
					mInfo.fMask = MIIM_TYPE;
					mInfo.dwTypeData = Tmp;
					mInfo.cch = FMAX_PATH;
					if(GetMenuItemInfo(hMenu, i, TRUE, &mInfo) == TRUE)
					{
						if(Len + strlen(Tmp) + 2 <= BOOKMARK_SIZE)
						{
							strcpy(Pos, Tmp);
							Pos += strlen(Tmp) + 1;
							Len += strlen(Tmp) + 1;
						}
					}
				}

				if(Pos == Buf)
				{
					memset(Buf, NUL, 2);
					Len = 2;
				}
				else
				{
					*Pos = NUL;
					Len++;
				}

				SetHostBookMark(CurHost, Buf, Len);

				free(Buf);
			}
		}
	}
	return;
}
Beispiel #10
0
void ClearBookMark(void)
{
	HMENU hMenu;

	hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);
	while(GetMenuItemCount(hMenu) > DEFAULT_BMARK_ITEM)
		DeleteMenu(hMenu, DEFAULT_BMARK_ITEM, MF_BYPOSITION);
	return;
}
Beispiel #11
0
LRESULT CPageDesignerApp::OnCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	UICUSTOMIZEMODLib::IUICustomizePtr	customize;
	if (SUCCEEDED(customize.CreateInstance(L"UICustomizeMod.UICustomize")))
	{
		CComQIPtr<IUIManager> uiManager = gIFrame;//m_frame;
		if (uiManager)
		{
			customize->Show(uiManager, (long)GetMainHwnd());
		}
	}
	else
	{
		MessageBox(GetMainHwnd(), "Couldn' load Customize object", "PageDesigner", MB_OK);
	}

	return 0;

#if 0
	HINSTANCE hLib = LoadLibrary("C:\\mmsx\\mmstudioplugins\\DOMCOREMOD.dll");
	if (hLib)
	{
		HTMLModelessDialogProc HTMLModelessDialog = (HTMLModelessDialogProc)GetProcAddress(hLib, "HTMLModelessDialog");
		if (HTMLModelessDialog)
		{
			CComQIPtr<IDispatch> disp = m_frame;
			_variant_t arg = (IDispatch*)disp;

			HTMLModelessDialog(GetMainHwnd(), L"C:\\mmstudio\\customize_toolbars.html", &arg, L"");
		}
		else
		{
			MessageBox(GetMainHwnd(), "Couldn't find proc", "WebEditor", MB_OK);
		}

		FreeLibrary(hLib);
	}
	else
	{
		MessageBox(GetMainHwnd(), "Couldn't load library", "WebEditor", MB_OK);
	}
#endif
}
Beispiel #12
0
void InsertSilence(COMMAND_T* _ct)
{
	char val[64]="";
	lstrcpyn(val, g_lastSilenceVal[(int)_ct->user], sizeof(val));

	if (PromptUserForString(GetMainHwnd(), SWS_CMD_SHORTNAME(_ct), val, sizeof(val)) && *val)
	{
		double pos = GetCursorPositionEx(NULL), len = 0.0;
		switch ((int)_ct->user)
		{
			case 0: // s
				len = parse_timestr_len(val, pos, 3);
				break;
			case 1: // meas.beat
			{
/* no! would not take get tempo markers into account since 'val' is not inserted yet
				len = parse_timestr_len(val, pos, 2);
				break;
*/
				int in_meas = atoi(val);
				double in_beats = 0.0;
				char* p = strchr(val, '.');
				if (p && p[1]) in_beats = atof(p+1);

				double bpm; int num, den;
				TimeMap_GetTimeSigAtTime(NULL, pos, &num, &den, &bpm);
				len = in_beats*(60.0/bpm) + in_meas*((240.0*num/den)/bpm);
				break;
			}
			case 2: // smp
				len = parse_timestr_len(val, pos, 4);
				break;
		}

		if (len>0.0) {
			lstrcpyn(g_lastSilenceVal[(int)_ct->user], val, sizeof(val));
			InsertSilence(SWS_CMD_SHORTNAME(_ct), pos, len); // includes an undo point
		}
		else
			MessageBox(GetMainHwnd(), __LOCALIZE("Invalid input!","sws_mbox"), __LOCALIZE("S&M - Error","sws_mbox"), MB_OK);
	}
}
Beispiel #13
0
static void SaveGrooveToFile(int flags, void *data)
{
    GrooveTemplateHandler *me = GrooveTemplateHandler::Instance();
    if(me->isGrooveEmpty())
    {
        MessageBox(GetMainHwnd(), __LOCALIZE("No groove loaded!","sws_mbox"), __LOCALIZE("FNG - Error","sws_mbox"), 0);
        return;
    }
    
    char cFilename[256];
    if (BrowseForSaveFile(__LOCALIZE("Select groove template","sws_mbox"), me->GetGrooveDir().c_str(), NULL,
                          "Reaper Groove Templates (*.rgt)\0*.rgt\0All Files (*.*)\0*.*\0", cFilename, 256))
    {
        std::string errMessage;
        std::string fName = cFilename;
        if(!me->SaveGroove(fName, errMessage))
            MessageBox(GetMainHwnd(), errMessage.c_str(), __LOCALIZE("FNG - Error","sws_mbox"), 0);
        else
            me->GetGrooveDialog()->Refresh();
    }
}
Beispiel #14
0
void OpenCueBussDlg(COMMAND_T* _ct)
{
	static HWND sHwnd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_SNM_CUEBUSS), GetMainHwnd(), CueBussDlgProc);
	if (g_cueBussHwnd) {
		g_cueBussHwnd = NULL;
		ShowWindow(sHwnd, SW_HIDE);
	}
	else {
		g_cueBussHwnd = sHwnd;
		ShowWindow(sHwnd, SW_SHOW);
		SetFocus(sHwnd);
	}
}
Beispiel #15
0
static int AddBookMark(char *Path)
{
	HMENU hMenu;
	int MarkID;
	int Sts;

	Sts = FAIL;
	hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);
	MarkID = (GetMenuItemCount(hMenu) - DEFAULT_BMARK_ITEM) + MENU_BMARK_TOP;
	if(AppendMenu(hMenu, MF_STRING, MarkID, Path) == TRUE)
		Sts = SUCCESS;
	return(Sts);
}
Beispiel #16
0
LRESULT CPageDesignerApp::OnEditEmptyClipboard(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	HWND hwnd = GetMainHwnd();

	if (MessageBox(hwnd, "Are you sure you want to empty the clipboard?", "WebEditor", MB_YESNO) == IDYES)
	{
		if (OpenClipboard(NULL))
		{
			EmptyClipboard();
			CloseClipboard();
		}
	}
	return 0;
}
Beispiel #17
0
static void LoadGrooveFromFile(int flags, void *data)
{
    GrooveTemplateHandler *me = GrooveTemplateHandler::Instance();
    char* cFilename = BrowseForFiles("Select groove template", me->GetGrooveDir().c_str(), NULL, false,
                                     "Reaper Groove Templates (*.rgt)\0*.rgt\0All Files (*.*)\0*.*\0");
    if (cFilename)
    {
        std::string errMessage;
        std::string fName = cFilename;
        if(!me->LoadGroove(fName, errMessage))
            MessageBox(GetMainHwnd(), errMessage.c_str(), __LOCALIZE("FNG - Error","sws_mbox"), 0);
        free(cFilename);
    }
}
Beispiel #18
0
void RmeTotalmix(RmeTotalmixCmd cmd)
{
	HWND hFirefaceWnd = FindWindow("Fireface Mixer Class 1", NULL);

	if(!hFirefaceWnd)
	{
		HWND hMainWnd = GetMainHwnd();
		MessageBox(hMainWnd, "RME Totalmix not found!", "Error", MB_OK);
		return;
	}

	BYTE vkKey;
	BYTE vkModKey = -1;
	switch(cmd)
	{
		case eTOTALMIX_LOADUSER1 : case eTOTALMIX_LOADUSER2 : case eTOTALMIX_LOADUSER3 : case eTOTALMIX_LOADUSER4 :
		case eTOTALMIX_LOADUSER5 : case eTOTALMIX_LOADUSER6 : case eTOTALMIX_LOADUSER7 : case eTOTALMIX_LOADUSER8 :
			vkModKey = VK_MENU;
			vkKey = (BYTE)VkKeyScan('1' + (cmd-eTOTALMIX_LOADUSER1));
		break;

		//! \bug Doesn't work: VK_CONTROL, VK_LCONTROL, VK_RCONTROL emulate 'alt' (VK_MENU) not 'ctrl'
		case eTOTALMIX_LOADFACT1 : case eTOTALMIX_LOADFACT2 : case eTOTALMIX_LOADFACT3 : case eTOTALMIX_LOADFACT4 :
		case eTOTALMIX_LOADFACT5 : case eTOTALMIX_LOADFACT6 : case eTOTALMIX_LOADFACT7 : case eTOTALMIX_LOADFACT8 :
			vkModKey = VK_CONTROL;
			vkKey = (BYTE)VkKeyScan('1' + (cmd-eTOTALMIX_LOADFACT1));
		break;

		case eTOTALMIX_MASTERMUTE :
			vkKey = (BYTE)VkKeyScan('M');
		break;
		
		default :
			return;
		break;
	}

	HWND hForegroundWnd = GetForegroundWindow();
	SetForegroundWindow(hFirefaceWnd);

	if(vkModKey != -1)
		keybd_event(vkModKey, 0, 0, 0);
	keybd_event(vkKey, 0, 0, 0);
	keybd_event(vkKey, 0, KEYEVENTF_KEYUP, 0);
	if(vkModKey != -1)
		keybd_event(vkModKey, 0, KEYEVENTF_KEYUP, 0);

	SetForegroundWindow(hForegroundWnd);
}
Beispiel #19
0
int PromptClearProjectStartupAction(bool _clear)
{
	int r=0, cmdId=SNM_NamedCommandLookup(g_prjActions.Get()->Get());
	if (cmdId)
	{
		WDL_FastString msg;
		msg.AppendFormatted(256,
			_clear ?
				__LOCALIZE_VERFMT("Are you sure you want to clear the current startup action: '%s'?","sws_mbox") :
				__LOCALIZE_VERFMT("Are you sure you want to replace the current startup action: '%s'?","sws_mbox"),
			kbd_getTextFromCmd(cmdId, NULL));
		r = MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Confirmation","sws_mbox"), MB_YESNO);
	}
	return r;
}
Beispiel #20
0
int AskBookMarkText(int MarkID, char *Local, char *Remote, int Max)
{
	HMENU hMenu;
	MENUITEMINFO mInfo;
	int Sts;
	char Tmp[BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN + 1];
	char *Path1;
	char *Path2;
	int Num;

	memset(Local, NUL, Max);
	memset(Remote, NUL, Max);

	Sts = BMARK_TYPE_NONE;
	hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);

	mInfo.cbSize = sizeof(MENUITEMINFO);
	mInfo.fMask = MIIM_TYPE;
	mInfo.dwTypeData = Tmp;
	mInfo.cch = BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN;
	if(GetMenuItemInfo(hMenu, MarkID, FALSE, &mInfo) == TRUE)
	{
		Num = GetBothPath(Tmp, &Path1, &Path2);
		if(strncmp(Tmp, BMARK_MARK_LOCAL, BMARK_MARK_LEN) == 0)
		{
			Sts = BMARK_TYPE_LOCAL;
			strncpy(Local, Path1, Max-1);
		}
		else if(strncmp(Tmp, BMARK_MARK_REMOTE, BMARK_MARK_LEN) == 0)
		{
			Sts = BMARK_TYPE_REMOTE;
			strncpy(Remote, Path1, Max-1);
		}
		else if(strncmp(Tmp, BMARK_MARK_BOTH, BMARK_MARK_LEN) == 0)
		{
			if(Num == 2)
			{
				strncpy(Local, Path1, Max-1);
				strncpy(Remote, Path2, Max-1);
				Sts = BMARK_TYPE_BOTH;
			}
		}
	}
	return(Sts);
}
Beispiel #21
0
static bool convertToInProjectMidi(RprItemCtrPtr &ctr)
{
    bool hasMidiFile = false;
    for(int i = 0; i < ctr->size(); i++) {
        RprTake take(ctr->getAt(i).getActiveTake());
        if(!take.isMIDI())
            continue;
        if(take.isFile()) {
            hasMidiFile = true;
            break;
        }
    }
    if(hasMidiFile) {
        if(MessageBox(GetMainHwnd(),
            __LOCALIZE("Current selection has takes with MIDI files.\r\nTo apply this action these takes must be converted to in-project takes.\r\nDo you want to continue?","sws_mbox"),
            __LOCALIZE("FNG - Warning","sws_mbox"), MB_YESNO) == IDNO) {
            return false;
        }
        Main_OnCommandEx(40684, 0 , 0);
    }
    return true;
}
Beispiel #22
0
void DisconnectRas(int Notify)
{
	RASCONN *RasConn;
	int Num;

	if(m_hDll != NULL)
	{
		if((Num = GetCurConnections(&RasConn)) != -1)
		{
			if(Num > 0)
			{
				if((Notify == NO) ||
				   (DialogBox(GetFtpInst(), MAKEINTRESOURCE(rasnotify_dlg), GetMainHwnd(), ExeEscDialogProc) == YES))
				{
					DoDisconnect(RasConn, Num);
				}
			}
			free(RasConn);
		}
	}
	return;
}
Beispiel #23
0
int PromptClearStartupAction(int _type, bool _clear)
{
	int r=0, cmdId=SNM_NamedCommandLookup(_type ? g_globalAction.Get() : g_prjActions.Get()->Get());
	if (cmdId)
	{
		WDL_FastString msg;
		if (!_type)
		{
			msg.AppendFormatted(512, _clear ?
                          __LOCALIZE_VERFMT("Are you sure you want to clear the project startup action: '%s'?","sws_startup_action") :
                          __LOCALIZE_VERFMT("Are you sure you want to replace the project startup action: '%s'?","sws_startup_action"),
                          kbd_getTextFromCmd(cmdId, NULL));
		}
		else
		{
			msg.AppendFormatted(512, _clear ?
                          __LOCALIZE_VERFMT("Are you sure you want to clear the global startup action: '%s'?","sws_startup_action") :
                          __LOCALIZE_VERFMT("Are you sure you want to replace the global startup action: '%s'?","sws_startup_action"),
                          kbd_getTextFromCmd(cmdId, NULL));
		}
		r = MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Confirmation","sws_mbox"), MB_YESNO);
	}
	return r;
}
Beispiel #24
0
LRESULT CPageDesignerApp::OnEditPreferences(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	CPropertySheet* sheet = new CPropertySheet("Preferences", 0, GetMainHwnd());

	CPrefsUnitsDlg	units;

	CPrefsGridsDlg	grids;
	grids.m_targetObject = this;

	CPrefsTransparencyDlg transp;
	transp.m_targetObject = this;

	CPrefsClipboardDlg clipboard;
	clipboard.m_targetObject = this;

	sheet->AddPage(grids);
	sheet->AddPage(units);
	sheet->AddPage(transp);
	sheet->AddPage(clipboard);

	sheet->DoModal();

	return 0;
}
Beispiel #25
0
//increase/decrease the metronome volume
void ChangeMetronomeVolume(COMMAND_T* _ct) {
    KBD_OnMainActionEx(999, 0x40+(int)_ct->user, -1, 2, GetMainHwnd(), NULL);
}
Beispiel #26
0
// _type: 0=Post-Fader (Post-Pan), 1=Pre-FX, 2=deprecated, 3=Pre-Fader (Post-FX)
// _undoMsg: NULL=no undo
bool CueBuss(const char* _undoMsg, const char* _busName, int _type, bool _showRouting,
			 int _soloDefeat, char* _trTemplatePath, bool _sendToMaster, int* _hwOuts) 
{
	if (!SNM_CountSelectedTracks(NULL, false))
		return false;

	WDL_FastString tmplt;
	if (_trTemplatePath && (!FileOrDirExists(_trTemplatePath) || !LoadChunk(_trTemplatePath, &tmplt) || !tmplt.GetLength()))
	{
		char msg[SNM_MAX_PATH] = "";
		lstrcpyn(msg, __LOCALIZE("Cue buss not created!\nNo track template file defined","sws_DLG_149"), sizeof(msg));
		if (*_trTemplatePath)
			_snprintfSafe(msg, sizeof(msg), __LOCALIZE_VERFMT("Cue buss not created!\nTrack template not found (or empty): %s","sws_DLG_149"), _trTemplatePath);
		MessageBox(GetMainHwnd(), msg, __LOCALIZE("S&M - Error","sws_DLG_149"), MB_OK);
		return false;
	}

	bool updated = false;
	MediaTrack * cueTr = NULL;
	SNM_SendPatcher* p = NULL;
	for (int i=1; i <= GetNumTracks(); i++) // skip master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			GetSetMediaTrackInfo(tr, "I_SELECTED", &g_i0);

			// add the buss track, done once!
			if (!cueTr)
			{
				InsertTrackAtIndex(GetNumTracks(), false);
				TrackList_AdjustWindows(false);
				cueTr = CSurf_TrackFromID(GetNumTracks(), false);
				GetSetMediaTrackInfo(cueTr, "P_NAME", (void*)_busName);

				p = new SNM_SendPatcher(cueTr);

				if (tmplt.GetLength())
				{
					WDL_FastString chunk;
					MakeSingleTrackTemplateChunk(&tmplt, &chunk, true, true, false);
					ApplyTrackTemplate(cueTr, &chunk, false, false, p);
				}
				updated = true;
			}

			// add a send
			if (cueTr && p && tr != cueTr)
				AddReceiveWithVolPan(tr, cueTr, _type, p);
		}
	}

	if (cueTr && p)
	{
		// send to master/parent init
		if (!tmplt.GetLength())
		{
			// solo defeat
			if (_soloDefeat) {
				char one[2] = "1";
				updated |= (p->ParsePatch(SNM_SET_CHUNK_CHAR, 1, "TRACK", "MUTESOLO", 0, 3, one) > 0);
			}
			
			// master/parend send
			WDL_FastString mainSend;
			mainSend.SetFormatted(SNM_MAX_CHUNK_LINE_LENGTH, "MAINSEND %d 0", _sendToMaster?1:0);

			// adds hw outputs
			if (_hwOuts)
			{
				int monoHWCount=0; 
				while (GetOutputChannelName(monoHWCount)) monoHWCount++;

				bool cr = false;
				for(int i=0; i<SNM_MAX_HW_OUTS; i++)
				{
					if (_hwOuts[i])
					{
						if (!cr) {
							mainSend.Append("\n"); 
							cr = true;
						}
						if (_hwOuts[i] >= monoHWCount) 
							mainSend.AppendFormatted(32, "HWOUT %d ", (_hwOuts[i]-monoHWCount) | 1024);
						else
							mainSend.AppendFormatted(32, "HWOUT %d ", _hwOuts[i]-1);

						mainSend.Append("0 ");
						mainSend.AppendFormatted(20, "%.14f ", *(double*)GetConfigVar("defhwvol"));
						mainSend.Append("0.00000000000000 0 0 0 -1.00000000000000 -1\n");
					}
				}
				if (!cr)
					mainSend.Append("\n"); // hot
			}

			// patch both updates (no break keyword here: new empty track)
			updated |= p->ReplaceLine("TRACK", "MAINSEND", 1, 0, mainSend.Get());
		}

		p->Commit();
		delete p;

		if (updated)
		{
			GetSetMediaTrackInfo(cueTr, "I_SELECTED", &g_i1);
			UpdateTimeline();
			ScrollSelTrack(true, true);
			if (_showRouting) 
				Main_OnCommand(40293, 0);
			if (_undoMsg)
				Undo_OnStateChangeEx2(NULL, _undoMsg, UNDO_STATE_ALL, -1);
		}
	}
	return updated;
}
Beispiel #27
0
STDMETHODIMP CPageDesignerApp::OpenDocument(BSTR pathName, VARIANT_BOOL *success)
{
#if 0
	TCHAR ext[512];
	_splitpath(_bstr_t(pathName), NULL, NULL, NULL, ext);

	CComQIPtr<IWebDocument> document;
	
	if (
		!stricmp(ext, ".htm") ||
		!stricmp(ext, ".html") ||
		!stricmp(ext, ".shtml") ||
		!stricmp(ext, ".asp") ||

		!stricmp(ext, ".svg") ||

		!stricmp(ext, ".smil") ||
		!stricmp(ext, ".smi") ||

		!stricmp(ext, ".xml") ||
		!stricmp(ext, ".xsd")/* ||

		!stricmp(ext, ".wmf") ||
		!stricmp(ext, ".emf")*/)
	{
		document.CoCreateInstance(CLSID_ESvgDocument);
	}
	else if (!stricmp(ext, ".dtd"))
	{
		document.CoCreateInstance(CLSID_DTDDocument);
	}
	else if (
		!stricmp(ext, ".js") ||
		!stricmp(ext, ".vbs"))
	{
		document.CoCreateInstance(CLSID_ExtScriptDocument);
	}
/*
	else if (!stricmp(ext, ".css"))
	{
	//	pDocument = new CCSSDocument;
	}
*/
	else
	{
		document.CoCreateInstance(CLSID_TextDocument);
	}

	if (document != NULL)
	{
		CComQIPtr<IPersistFile> ifile = document;
		if (ifile != NULL)
		{
			HRESULT hr = ifile->Load(pathName, STGM_READ);
			if (SUCCEEDED(hr))
			{
				document->ShowViews();

				m_frame->ActivateObject(document);
			}
			else
			{
				MessageBox(GetMainHwnd(), "Error loading file", "WebEditor", MB_OK);
			}
		}
		else
		{
			MessageBox(GetMainHwnd(), "Document didn't support loading from file", "WebEditor", MB_OK);
		}
	}
#endif
	return S_OK;
}
Beispiel #28
0
LRESULT CPageDesignerApp::OnFileOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	static LPCTSTR FilesFilter = _T(	"All Files\0*.*\0"
												"PageDesigner Document (*.pddoc)\0*.pddoc\0"
												);

	TCHAR sbuffer[4096];
	strcpy(sbuffer, "");	// Initial filename
	
	TCHAR curdir[MAX_PATH];
	GetCurrentDirectory(sizeof(curdir), curdir);

	HWND hwnd = GetMainHwnd();

	OPENFILENAME	ofn = {0};
	ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;//sizeof(OPENFILENAME);
	ofn.hwndOwner = hwnd;
	ofn.hInstance = _Module.m_hInst;
	ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
	ofn.lpstrFile = sbuffer;
	ofn.nMaxFile = sizeof(sbuffer);
	ofn.lpstrInitialDir = curdir;
	ofn.lpstrFilter = FilesFilter;
	
	if (GetOpenFileName(&ofn))
	{
		BOOL success = FALSE;

		CComPtr<IArchive> ar;
		ar.CoCreateInstance(CLSID_Archive);

		CComPtr<IArchiveElement> node;
		if (SUCCEEDED(ar->Open(_bstr_t(sbuffer), 2, L"pddoc", &node)))
		{
			CComObject<CPDDocument>* pddocument;
			CComObject<CPDDocument>::CreateInstance(&pddocument);
			if (pddocument)
			{
				pddocument->AddRef();

				HRESULT hr = pddocument->Deserialize(ar, node, NULL);
				success = SUCCEEDED(hr);

				pddocument->ShowViews();
			}
		}


		/*
		LPTSTR ext = PathFindExtension(sbuffer);

		CComPtr<IDOMDocument> document;
		document.CoCreateInstance(CLSID_LDOMDocument);

		VARIANT_BOOL bloaded;
		document->load(_bstr_t(sbuffer), &bloaded);
		if (bloaded)
		{
			CComPtr<IDOMElement> documentElement;
			document->get_documentElement(&documentElement);
			if (documentElement)
			{
				CComObject<CPDDocument>* pddocument;
				CComObject<CPDDocument>::CreateInstance(&pddocument);
				if (pddocument)
				{
					pddocument->AddRef();

					HRESULT hr = pddocument->loadXML(documentElement);
					success = SUCCEEDED(hr);

					pddocument->ShowViews();
				}
			}
		}
		*/

		if (!success)
		{
			MessageBox(GetMainHwnd(), "Failed to load document", "PageDesigner", MB_OK);
		}
	}
	return 0;
}
Beispiel #29
0
LRESULT CPageDesignerApp::OnFileNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	CNewDocumentDlg dlg;

	dlg.m_numPages = 1;

	dlg.m_pageWidth = ConvertSpecifiedValueToUserUnit(UNIT_PT, 612);
	dlg.m_pageHeight = ConvertSpecifiedValueToUserUnit(UNIT_PT, 792);

	dlg.m_marginLeft = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36);
	dlg.m_marginRight = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36);
	dlg.m_marginTop = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36);
	dlg.m_marginBottom = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36);

	dlg.m_columnNumber = 1;
	dlg.m_columnGutter = ConvertSpecifiedValueToUserUnit(UNIT_PT, 12);

	dlg.m_facingPages = TRUE;

	if (dlg.DoModal(GetMainHwnd(), NULL) == IDOK)
	{
		CComObject<CPDDocument>* pDocument;
		CComObject<CPDDocument>::CreateInstance(&pDocument);
		if (pDocument)
		{
			pDocument->AddRef();

			pDocument->m_pageWidth = dlg.m_pageWidth;
			pDocument->m_pageHeight = dlg.m_pageHeight;

			pDocument->m_marginTop = dlg.m_marginTop;
			pDocument->m_marginBottom = dlg.m_marginBottom;
			pDocument->m_marginInside = dlg.m_marginLeft;
			pDocument->m_marginOutside = dlg.m_marginRight;

			pDocument->m_columnNumber = dlg.m_columnNumber;
			pDocument->m_columnGutter = dlg.m_columnGutter;

			pDocument->m_facingPages = dlg.m_facingPages? VARIANT_TRUE: VARIANT_FALSE;

			WCHAR str[256];
			swprintf(str, L"Untitled%d.pddoc", ++m_nextDocumentIndex);
			pDocument->m_fileTitle = str;

			pDocument->NewDocument();	// Init (?)
			pDocument->CreatePages(dlg.m_numPages);

			pDocument->ShowViews();

		//	CComQIPtr<IUIManager> uiManager = m_frame;
		//	CComQIPtr<IPDDocument> document = pDocument;

		//	CComPtr<IUnknown> _this;
		//	QueryInterface(IID_IUnknown, (void**)&_this);

			//uiManager->ActivateObject(GetUnknown(), document);
		}
	}
#if 0
	HINSTANCE hLib = LoadLibrary("C:\\mmsx\\mmstudioplugins\\DOMCOREMOD.dll");
	if (hLib)
	{
		HTMLModalDialogProc HTMLModalDialog = (HTMLModalDialogProc)GetProcAddress(hLib, "HTMLModalDialog");
		if (HTMLModalDialog)
		{
			CComQIPtr<IDOMDocument> xmldoc;
			xmldoc.CoCreateInstance(CLSID_LDocument);
			xmldoc->put_async(VARIANT_FALSE);
			VARIANT_BOOL success;
			xmldoc->loadXML(L"<newdocument/>", &success);

			CComQIPtr<IDOMElement> element;
			xmldoc->get_documentElement(&element);

			WCHAR buf[64];

			swprintf(buf, L"%d", 1);
			element->setAttribute(L"pagesnum", buf);

			swprintf(buf, L"%d", 1);
			element->setAttribute(L"columnsnum", buf);

			swprintf(buf, L"%dpt", 1);
			element->setAttribute(L"columnsgutter", buf);

			_variant_t arg = (IDispatch*)element.p;

			_variant_t result;
			HTMLModalDialog(GetMainHwnd(), L"C:\\MMStudio\\pd_newdocument.html", &arg, L"", &result);

			CComObject<CPDDocument>* pDocument;
			CComObject<CPDDocument>::CreateInstance(&pDocument);
			if (pDocument)
			{
				pDocument->AddRef();

				pDocument->NewDocument();	// Init (?)

				pDocument->m_pageWidth = 200;
				pDocument->m_pageHeight = 400;
				pDocument->CreatePages(4);

				pDocument->ShowViews();

				CComQIPtr<IUIManager> uiManager = m_frame;
				CComQIPtr<IPDDocument> document = pDocument;

				CComPtr<IUnknown> _this;
				QueryInterface(IID_IUnknown, (void**)&_this);

				uiManager->ActivateObject(_this, document);
			}
		}
		else
		{
			MessageBox(GetMainHwnd(), "Couldn't find proc", "PageDesigner", MB_OK);
		}

		FreeLibrary(hLib);
	}
	else
	{
		MessageBox(GetMainHwnd(), "Couldn't load library", "PageDesigner", MB_OK);
	}
#endif

#if 0
	CComObject<CESvgDocument>* pDocument;
	CComObject<CESvgDocument>::CreateInstance(&pDocument);
	pDocument->AddRef();

	if (pDocument != NULL)
	{
		pDocument->NewDocument();
		pDocument->ShowViews();

		CComPtr<IUnknown> unk;
		pDocument->QueryInterface(IID_IUnknown, (void**)&unk);
		m_frame->ActivateObject(unk);
	}
#endif
	return 0;
}
Beispiel #30
0
int ConnectRas(int Dialup, int UseThis, int Notify, char *Name)
{
	RASDIALDLG DlgParam;
	RASCONN *RasConn;
	int i;
	int Num;
	int Sts;
	int DoDial;
	RASDIALPARAMS Param;
	BOOL Flg;
	OSVERSIONINFO VerInfo;

	Sts = SUCCESS;
	if(Dialup == YES)
	{
		if(m_hDll != NULL)
		{
			/* 現在の接続を確認 */
			DoDial = 1;
			if((Num = GetCurConnections(&RasConn)) != -1)
			{
				if(Num > 0)
				{
					DoDial = 0;
					if(UseThis == YES)
					{
						DoDial = 2;
						for(i = 0; i < Num; i++)
						{
							if(_mbscmp(RasConn[i].szEntryName, Name) == 0)
								DoDial = 0;
						}

						if(DoDial == 2)
						{
							if((Notify == NO) ||
							   (DialogBox(GetFtpInst(), MAKEINTRESOURCE(rasreconnect_dlg), GetMainHwnd(), ExeEscDialogProc) == YES))
							{
								DoDisconnect(RasConn, Num);
							}
							else
								DoDial = 0;
						}
					}
				}
				free(RasConn);
			}

			if(DoDial != 0)
			{
				/* 接続する */
				SetTaskMsg(MSGJPN221);
				Sts = FAIL;

				Num = 0;
				VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
				if(GetVersionEx(&VerInfo) == TRUE)
				{
					if(VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
						Num = 1;
				}

				if(Num == 1)
				{
					if(m_hDll2 != NULL)
					{
						/* Windows NT */
						DlgParam.dwSize = sizeof(RASDIALDLG);
						DlgParam.hwndOwner = GetMainHwnd();
						DlgParam.dwFlags = 0;
						DlgParam.dwSubEntry = 0;
						DlgParam.reserved = 0;
						DlgParam.reserved2 = 0;
						if((*m_RasDialDlg)(NULL, Name, NULL, &DlgParam) != 0)
							Sts = SUCCESS;
					}
					else
						SetTaskMsg(MSGJPN222);
				}
				else
				{
					/* Windows 95,98 */
					Param.dwSize = sizeof(RASDIALPARAMS);
					strcpy(Param.szEntryName, Name);
					Flg = TRUE;
					Sts = (*m_RasGetEntryDialParams)(NULL, &Param, &Flg);
					strcpy(Param.szPhoneNumber, "");

					if(((strlen(Param.szUserName) != 0) && (strlen(Param.szPassword) != 0)) ||
					   (DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(dial_password_dlg), GetMainHwnd(), (DLGPROC)DialPassCallBackProc, (LPARAM)&Param) == YES))
					{
						if(DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(dial_dlg), GetMainHwnd(), (DLGPROC)DialCallBackProc, (LPARAM)&Param) == YES)
							Sts = SUCCESS;
					}
				}
			}
		}
	}
	return(Sts);
}