Ejemplo n.º 1
0
COptions::COptions()
{
	m_theOptions = this;
	m_pXmlFile = 0;
	m_pLastServer = 0;

	m_acquired = false;

	SetDefaultValues();

	m_save_timer.SetOwner(this);

	std::map<std::string, int> nameOptionMap;
	GetNameOptionMap(nameOptionMap);

	LoadGlobalDefaultOptions(nameOptionMap);

	InitSettingsDir();

	CInterProcessMutex mutex(MUTEX_OPTIONS);
	m_pXmlFile = new CXmlFile(_T("filezilla"));
	if (!m_pXmlFile->Load(wxFileName()))
	{
		wxString msg = m_pXmlFile->GetError() + _T("\n\n") + _("For this session the default settings will be used. Any changes to the settings will not be saved.");
		wxMessageBox(msg, _("Error loading xml file"), wxICON_ERROR);
		delete m_pXmlFile;
		m_pXmlFile = 0;
	}
	else
		CreateSettingsXmlElement();

	LoadOptions(nameOptionMap);
}
Ejemplo n.º 2
0
COptions::COptions()
{
	m_theOptions = this;
	m_pXmlFile = 0;
	m_pLastServer = 0;

	SetDefaultValues();

	m_save_timer.SetOwner(this);

	auto const nameOptionMap = GetNameOptionMap();
	LoadGlobalDefaultOptions(nameOptionMap);

	CLocalPath const dir = InitSettingsDir();

	CInterProcessMutex mutex(MUTEX_OPTIONS);
	m_pXmlFile = new CXmlFile(dir.GetPath() + _T("filezilla.xml"));
	if (!m_pXmlFile->Load()) {
		wxString msg = m_pXmlFile->GetError() + _T("\n\n") + _("For this session the default settings will be used. Any changes to the settings will not be saved.");
		wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
		delete m_pXmlFile;
		m_pXmlFile = 0;
	}
	else
		CreateSettingsXmlElement();

	LoadOptions(nameOptionMap);
}
Ejemplo n.º 3
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);
	mir_getCLI();

	use_raw_ping = false;
	db_set_b(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping);

	DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0);
	hWakeEvent = CreateEvent(NULL, FALSE, FALSE, _T("Local\\ThreadWaitEvent"));

	// create services before loading options - so we can have the 'getlogfilename' service!
	CreatePluginServices();

	LoadOptions();

	SkinAddNewSound("PingTimeout", "Ping Timout", 0);
	SkinAddNewSound("PingReply", "Ping Reply", 0);

	HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);

	HookEvent(ME_OPT_INITIALISE, PingOptInit);

	HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);

	Icon_Register(hInst, LPGEN("Ping"), iconList, _countof(iconList));

	HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);

	return 0;
}
Ejemplo n.º 4
0
HeightMap::HeightMap()
{
	pHM = this;
	msh = &mesh;
	HeightMapDesc.MakeAutoParamBlocks(this);
	LoadOptions();
}
Ejemplo n.º 5
0
int ModulesLoaded(WPARAM, LPARAM)
{
	InitFonts();
	
	hAvChangeEvent = HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
	hShowTipEvent = HookEvent(ME_CLC_SHOWINFOTIP, ShowTipHook);
	hHideTipEvent = HookEvent(ME_CLC_HIDEINFOTIP, HideTipHook);
	hAckEvent = HookEvent(ME_PROTO_ACK, ProtoAck);

	hFramesSBShow = HookEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP, FramesShowSBTip);
	hFramesSBHide = HookEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP, FramesHideSBTip);

	hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);

	hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Tipper"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER));
	FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));

	InitTipperSmileys();
	LoadOptions();
	ReloadFont(0, 0);
	ParseSkinFile(opt.szSkinName, true, false);

	// set 'time-in'
	CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);

	// set Miranda start timestamp
	db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(0));
	return 0;
}
Ejemplo n.º 6
0
// ---
STDMETHODIMP CCodeGen::ImplementationGenerate( DWORD clen, BYTE* cont, DWORD olen, BYTE* opt ) {
	int interfaces = 0;
	int selected = 0;
	int option_checked = 0;
	
	HRESULT hr = LoadContents( clen, cont );
	if ( FAILED(hr) )
		return hr;

	hr = LoadOptions( olen, opt );
	if ( FAILED(hr) )
		return hr;

	m_iface.GoFirst();
	while( m_iface ) {
		interfaces++;
		if ( m_iface.Selected() )
			selected++;
		if ( m_opt.some_option() )
			option_checked++;
		m_iface.GoNext();
	}

	m_iface = 0;
	return S_OK;
}
Ejemplo n.º 7
0
int ModulesLoaded(WPARAM wParam, LPARAM lParam) 
{
	InitFonts();
	InitUpdaterSupport();

	hAvChangeEvent = HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
	hShowTipEvent = HookEvent(ME_CLC_SHOWINFOTIP, ShowTipHook);
	hHideTipEvent = HookEvent(ME_CLC_HIDEINFOTIP, HideTipHook);
	hAckEvent = HookEvent(ME_PROTO_ACK, ProtoAck);

	hFramesSBShow = HookEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP, FramesShowSBTip);
	hFramesSBHide = HookEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP, FramesHideSBTip);

	hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);

	hSkinFolder = FoldersRegisterCustomPathT(MODULE, "Tipper skins", MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER));
	FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));

	InitTipperSmileys();
	LoadOptions(); 
	ReloadFont(0, 0);
	ParseSkinFile(opt.szSkinName, true, false);

	// set 'time-in'
	CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);

	// set Miranda start timestamp
	DBWriteContactSettingDword(0, MODULE, "MirandaStartTS", (DWORD)time(0));

	// get MetaContacts module name
	if (ServiceExists(MS_MC_GETPROTOCOLNAME))
		strcpy(szMetaModuleName, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0));

	return 0;
}
Ejemplo n.º 8
0
extern "C" PING_API int Load(PLUGINLINK *link)
{
	pluginLink=link;

	//if(init_raw_ping()) {
		//MessageBox(0, Translate("Failed to initialize. Plugin disabled."), Translate("Ping Plugin"), MB_OK | MB_ICONERROR);
		//return 1;
		use_raw_ping = false;
	//}
	DBWriteContactSettingByte(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping);

	DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 );
	hWakeEvent = CreateEvent(NULL, FALSE, FALSE, "Local\\ThreadWaitEvent");

	InitializeCriticalSection(&list_cs);
	InitializeCriticalSection(&thread_finished_cs);
	InitializeCriticalSection(&list_changed_cs);
	InitializeCriticalSection(&data_list_cs);
	
	// create services before loading options - so we can have the 'getlogfilename' service!
	CreatePluginServices();

	LoadOptions();

	SkinAddNewSound("PingTimeout", "Ping Timout", 0);
	SkinAddNewSound("PingReply", "Ping Reply", 0);

	HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);	

	HookEvent(ME_OPT_INITIALISE, PingOptInit );

	HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);

	return 0;
}
Ejemplo n.º 9
0
int ModulesLoad(WPARAM, LPARAM)
{
	profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));

	if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
		HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
		FoldersGetBackupPath(0, 0);
	}

	CreateServiceFunction(MS_AB_BACKUP, ABService);
	CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);

	CMenuItem mi;
	mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000);

	mi.name.a = LPGEN("Backup profile");
	mi.pszService = MS_AB_BACKUP;
	mi.hIcolibItem = iconList[0].hIcolib;
	mi.position = 500100000;
	Menu_AddMainMenuItem(&mi);

	mi.name.a = LPGEN("Save profile as...");
	mi.pszService = MS_AB_SAVEAS;
	mi.hIcolibItem = iconList[1].hIcolib;
	mi.position = 500100001;
	Menu_AddMainMenuItem(&mi);

	HookEvent(ME_OPT_INITIALISE, OptionsInit);
	LoadOptions();

	if (options.backup_types & BT_START)
		BackupStart(NULL);
	return 0;
}
Ejemplo n.º 10
0
void COptions::Import(pugi::xml_node element)
{
	LoadOptions(GetNameOptionMap(), element);
	if (!m_save_timer.IsRunning()) {
		m_save_timer.Start(15000, true);
	}
}
Ejemplo n.º 11
0
extern "C" int __declspec(dllexport) Load(void) 
{
	mir_getLP(&pluginInfoEx);

	// initialize global variables
	InitVar();

	// load options and set defaults
	LoadOptions();

	// reset the weather data at startup for individual contacts
	EraseAllInfo();

	// load weather update data
	LoadWIData(true);

	// set status to online if "Do not display weather condition as protocol status" is enabled
	old_status = status = ID_STATUS_OFFLINE;

	// add an event on weather update and error
	hHookWeatherUpdated = CreateHookableEvent(ME_WEATHER_UPDATED);
	hHookWeatherError = CreateHookableEvent(ME_WEATHER_ERROR);

	// initialize options and network
	HookEvent(ME_OPT_INITIALISE, OptInit);
	HookEvent(ME_SYSTEM_MODULESLOADED, WeatherInit);
	HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
	HookEvent(ME_CLIST_DOUBLECLICKED, BriefInfo);
	HookEvent(ME_WEATHER_UPDATED, WeatherPopup);
	HookEvent(ME_WEATHER_ERROR, WeatherError);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, WeatherShutdown);
	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, BuildContactMenu);

	hDataWindowList = WindowList_Create();
	hWindowList = WindowList_Create();

	hUpdateMutex = CreateMutex(NULL, FALSE, NULL);

	// register weather protocol
	PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
	pd.szName = WEATHERPROTONAME;
	pd.type = (opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL;
	CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);

	// initialize weather protocol services
	InitServices();

	// add sound event
	SkinAddNewSoundExT("weatherupdated", _T(WEATHERPROTONAME), LPGENT("Weather Condition Changed"));
	SkinAddNewSoundExT("weatheralert", _T(WEATHERPROTONAME), LPGENT("Weather Alert Issued"));

	// window needed for popup commands
	TCHAR SvcFunc[100];
	mir_sntprintf(SvcFunc, SIZEOF(SvcFunc), _T("%s__PopupWindow"), _T(WEATHERPROTONAME));
	hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
		CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
	SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
	return 0; 
}
Ejemplo n.º 12
0
static int PluginCommand_CicleThroughtProtocols(WPARAM wParam,LPARAM lParam)
{
	DBWriteContactSettingByte(NULL,"MyDetails","CicleThroughtProtocols", (BYTE) wParam);

	LoadOptions();

	return 0;
}
Ejemplo n.º 13
0
static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam,LPARAM lParam)
{
	db_set_b(NULL,"MyDetails","CicleThroughtProtocols", (BYTE) wParam);

	LoadOptions();

	return 0;
}
Ejemplo n.º 14
0
void COptions::Import(TiXmlElement* pElement)
{
	std::map<std::string, int> nameOptionMap;
	GetNameOptionMap(nameOptionMap);
	LoadOptions(nameOptionMap, pElement);
	if (!m_save_timer.IsRunning())
		m_save_timer.Start(15000, true);
}
Ejemplo n.º 15
0
edOptions::edOptions() : edNode(false), iniFile("editor.ini")
{
    useSRTM= true;
    useTerrain= true;
    defaultHeight= 0;
    linesInPreview3D= false;
    LoadOptions();
}
Ejemplo n.º 16
0
void InitOptions()
{
	HookEvent(ME_OPT_INITIALISE, OptInit);

	// an icon for preview popups
	hPopupIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
	LoadOptions();
}
Ejemplo n.º 17
0
BOOL CColorsPP::OnInitDialog()
{
	CPropertyPage::OnInitDialog();
	RefreshStrings();
	LoadOptions();
	EnumChildWindows(m_hWnd, SetFontToChilds, (LPARAM) PRGAPI()->GetFont(FONT_Dialogs)->m_hObject);

	return TRUE;  // return TRUE unless you set the focus to a control
}
Ejemplo n.º 18
0
void CPropPageOptionsControls::OnApplyStyle()
{
	//need to apply the style. Get the name of the style first
	CString sStyle = GetStyleName();

	//now try and create it (we do this first before warning, just in
	//case the style is bad, then we don't need to warn the user)
	CKeyDefaultAggregate* pAggregate = CKeyDefaultFactory::CreateDefault(sStyle);

	if(pAggregate == NULL)
	{
		CString sStyleError;
		sStyleError.LoadString(IDS_APPLY_STYLE_FAILED);
		MessageBox(sStyleError, "Error", MB_OK | MB_ICONEXCLAMATION);
		return;
	}

	//first warn the user of their actions.
	CString sWarning;
	CString sWarningTitle;

	sWarningTitle.LoadString(IDS_APPLY_STYLE_WARNING_TITLE);
	sWarning.Format(IDS_APPLY_STYLE_WARNING, GetStyleName());

	if(MessageBox(sWarning, sWarningTitle, MB_OK | MB_YESNO | MB_ICONQUESTION) == IDNO)
	{
		//the user aborted
		delete pAggregate;
		return;
	}

	//the user actually wants to apply this style

	//add the aggregate
	CGlobalHotKeyDB::ClearAggregateList();
	CGlobalHotKeyDB::AddAggregate(pAggregate);

	//reset the keys to reflect these defaults
	CHotKeyDB NewDB;
	CGlobalHotKeyDB::SetDefaults(NewDB);

	//now set this to the app (this resets internal state, etc)
	GetApp()->SetHotKeyDB(NewDB);

	//now give the configuration a chance to modify the global options
	CKeyDefaultFactory::UpdateGlobalOptions(sStyle);

	//now that they have done that, we need to refresh this dialog
	LoadOptions();

	//for the last thing, we need to save this setting so that it can be loaded up
	//the next time we run
	GetApp()->GetOptions().GetControlsOptions()->SetStringValue("ControlStyle", sStyle);

	// success
}
Ejemplo n.º 19
0
BOOL CSoundOptionsDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	LoadOptions();

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 20
0
// Load unload
void OptionsMenu::Load()
{
	// Load options to GUI
	LoadOptions();

	m_pGameplayMode->SetToggled(true);
	GameplayTabPressed();

	m_loaded = true;
}
Ejemplo n.º 21
0
uintptr_t CPROC ProcessDisplayMessages( PTHREAD thread )
{
	XEvent event;
	struct display_camera *camera;
	INDEX idx;
	struct display_camera *did_one;
	LoadOptions(); // loads camera config, and logging options...
	SACK_Vidlib_OpenCameras();  // create logical camera structures
	l.bThreadRunning = 1;
	while( !l.bExitThread )
	{
		did_one = NULL;
		LIST_FORALL( l.cameras, idx, struct display_camera *, camera )
		{
		//lprintf( "Checking Thread %Lx", GetThreadID( MakeThread() ) );
			if( !camera->hVidCore )
            continue;
			GLWindow *x11_gl_window = camera->hVidCore->x11_gl_window;
			if( !x11_gl_window && ( l.bottom ) )
			{
				x11_gl_window = createGLWindow( camera );  // opens the physical device
			}
			//lprintf( "is it %Lx?", GetThreadID( thread ) );
			if( x11_gl_window && x11_gl_window->dpy )
			{
				did_one = camera;
				while( XPending( x11_gl_window->dpy ) > 0 )
				{
					XNextEvent(x11_gl_window->dpy, &event);
					//if( l.flags.bLogMessageDispatch )
					//	lprintf( WIDE("(E)Got message:%d"), event.type );
					HandleMessage( camera->hVidCore, x11_gl_window, &event );
					//if( l.flags.bLogMessageDispatch )
					//	lprintf( WIDE("(X)Got message:%d"), event.type );
				}
				//lprintf( "Draw GL..." );
				//drawGLScene( camera, x11_gl_window );

				//  calls Update; moves the camera if it has a motion...
				// does a global tick then draws all cameras
				// returns if draw should be done; might step and draw one message
				// loop for each camera instead
				ProcessGLDraw( TRUE );
			}
			
			
		}
		if( !did_one )
			WakeableSleep( 1000 );
      else
			Relinquish();
	}
	return 1;
}
Ejemplo n.º 22
0
//menu
//Function which makes the initializations
static int ModulesLoaded(WPARAM,LPARAM)
{
    //check if History++ is installed
    gbHppInstalled = ServiceExists(MS_HPP_GETVERSION) && ServiceExists(MS_HPP_EG_WINDOW) &&
                     (CallService(MS_HPP_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(1,5,0,112));
    //check if MText plugin is installed
    if (MText.Register) {
        htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT);
        htuTitle	= MText.Register("Popup Plus/Title",MTEXT_FANCY_DEFAULT);
    }
    else htuTitle = htuText = NULL;

    // init meta contacts
    INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
    if (ptr != CALLSERVICE_NOTFOUND)
        gszMetaProto = (LPCSTR)ptr;

    //check if OptionLoaded
    if (!OptionLoaded)
        LoadOptions();

    //Uninstalling purposes
    if (ServiceExists("PluginSweeper/Add"))
        CallService("PluginSweeper/Add", (WPARAM)Translate(MODULNAME), (LPARAM)MODULNAME);

    //load fonts / create hook
    InitFonts();
    HookEvent(ME_FONT_RELOAD, FontsChanged);

    //load actions and notifications
    LoadActions();
    LoadNotifications();
    //hook TopToolBar
    HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
    //Folder plugin support
    folderId = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Popup Plus"), MIRANDA_PATHT _T("\\Skins\\Popup"));
    //load skin
    skins.load(_T("dir"));
    const PopupSkin *skin;
    if (skin = skins.getSkin(PopupOptions.SkinPack)) {
        mir_free(PopupOptions.SkinPack);
        PopupOptions.SkinPack = mir_tstrdup(skin->getName());
        skin->loadOpts();
    }
    //init PopupEfects
    PopupEfectsInitialize();
    //MessageAPI support
    SrmmMenu_Load();
    //Hotkey
    LoadHotkey();

    gbPopupLoaded = TRUE;
    return 0;
}
Ejemplo n.º 23
0
static int ModulesLoad(WPARAM, LPARAM)
{
	profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));

	MenuInit();
	FoldersInit();
	LoadOptions();

	if (options.backup_types & BT_START)
		mir_forkthread(BackupThread, NULL);
	return 0;
}
Ejemplo n.º 24
0
	void Sound::Init()
	{

		FMOD::System_Create(&system);
		system->init(32, FMOD_INIT_NORMAL, 0);
		LoadOptions();
		
		musicChannel=0;

		if (bSoundEnabled)
			CacheSounds();

	}
Ejemplo n.º 25
0
void InitOptions()
{
	playersControls[0].var = &players[WATRACK]->enabled;
	playersControls[2].var = &players[WINAMP]->enabled;
	playersControls[3].var = &players[ITUNES]->enabled;
	playersControls[4].var = &players[WMP]->enabled;
	playersControls[5].var = &players[FOOBAR]->enabled;
	playersControls[6].var = &players[MRADIO]->enabled;

	LoadOptions();

	hOptHook = HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
}
DialogOptions::DialogOptions(QWidget *parent) : QDialog(parent), ui(new Ui::DialogOptions)
{
/* On construit le formulaire */
 ui->setupUi(this);

/* On procède aux initialisations supplémentaires */
 this->setFixedSize(this->size());
 LoadOptions();

/* On définie les connections */
 this->connect(ui->pBOk, SIGNAL(clicked()), this, SLOT(QuitWithChange()));
 this->connect(ui->pBCancel, SIGNAL(clicked()), this, SLOT(QuitWithoutchange()));
 this->connect(ui->pBApply, SIGNAL(clicked()), this, SLOT(ApplyChange()));
}
Ejemplo n.º 27
0
bool CTaskFileHelper::Load(const TCHAR* szFileName) {
    CScopeLock LockTask(LockTaskData, UnlockTaskData);
    StartupStore(_T(". LoadTask : <%s>%s"), szFileName, NEWLINE);

    ClearTask();

    FILE* stream = _tfopen(szFileName, TEXT("rb"));
    if (stream) {
        fseek(stream, 0, SEEK_END); // seek to end of file
        long size = ftell(stream); // get current file pointer
        fseek(stream, 0, SEEK_SET); // seek back to beginning of file

        char * buff = (char*) calloc(size + 1, sizeof (char));
        long nRead = fread(buff, sizeof (char), size, stream);
        if (nRead != size) {
            fclose(stream);
            free(buff);
            return false;
        }
        fclose(stream);
        TCHAR * szXML = (TCHAR*) calloc(size + 1, sizeof (TCHAR));
        utf2unicode(buff, szXML, size + 1);
        free(buff);
        XMLNode rootNode = XMLNode::parseString(szXML, _T("lk-task"));

        if (rootNode) {
            LoadWayPointList(rootNode.getChildNode(_T("waypoints"), 0));
            if (!LoadTaskPointList(rootNode.getChildNode(_T("taskpoints"), 0))) {
                free(szXML);
                return false;
            }
            if (!LoadStartPoint(rootNode.getChildNode(_T("startpoints"), 0))) {
                free(szXML);
                return false;
            }
            LoadOptions(rootNode);
        }

        free(szXML);
    }

    RefreshTask();

    TaskModified = false;
    TargetModified = false;
    _tcscpy(LastTaskFileName, szFileName);

    return true;
}
Ejemplo n.º 28
0
	// Displays the exporter options dialog to allow the user to change the options.
	bool Options::ShowDialog()
	{

		LoadOptions();
		// Prompt the user with our dialogbox, and get all the options.
		bool doExport = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EXPORT_OPTIONS), mMaxInterface->GetMAXHWnd(), ExportOptionsDlgProcS, (LPARAM)this) != FALSE;
		
		if (!doExport) 
			return false;

		// Save the export options to the configuration file
		SaveOptions();

		return true;
	}
Ejemplo n.º 29
0
void FarPlugin::Create()
{
    InitLang();

    if (!dialogs.Load(GetDLLPath() + L"\\resource\\dialogs.objd"))
    {
        FWError(L"Could not load dialogs.objd");
        exit(0);
    }
    InitOptions();
    LoadOptions();

    descs.AddString(L"Descript.ion");
    descs.AddString(L"Files.bbs");
    UpdateConfiguration();
}
Ejemplo n.º 30
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfoEx);

	TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\" DEFAULT_UPDATES_FOLDER));
	mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot));

	hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
	if (hPackUpdaterFolder)
		FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, _T(""));

	mir_free(tszFolder);
	LoadOptions();
	InitPopupList();
	NetlibInit();
	IcoLibInit();

	// Add cheking update menu item
	CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand);

	CMenuItem mi;
	SET_UID(mi, 0x326495e8, 0xab0a, 0x47d2, 0xb2, 0x22, 0x2a, 0x8e, 0xa8, 0xae, 0x53, 0x1a);
	mi.position = -0x7FFFFFFF;
	mi.flags = CMIF_TCHAR;
	mi.hIcolibItem = IcoLib_GetIcon("check_update");
	mi.name.t = LPGENT("Check for pack updates");
	mi.pszService = MODNAME"/CheckUpdates";
	Menu_AddMainMenuItem(&mi);
	// Add empty updates folder menu item
	CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder);
	memset(&mi, 0, sizeof(mi));
	SET_UID(mi, 0xc3eea590, 0xaba3, 0x454f, 0x93, 0x93, 0xbc, 0x97, 0x15, 0x2c, 0x3b, 0x3d);
	mi.position = -0x7FFFFFFF;
	mi.flags = CMIF_TCHAR;
	mi.hIcolibItem = IcoLib_GetIcon("empty_folder");
	mi.name.t = LPGENT("Clear pack updates folder");
	mi.pszService = MODNAME"/EmptyFolder";
	Menu_AddMainMenuItem(&mi);

	// Add options hook
	HookEvent(ME_OPT_INITIALISE, OptInit);
	HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);

	return 0;
}