예제 #1
0
void MusicPaymentPreview::SetupViews()
{
  payment_preview_model_ = dynamic_cast<dash::PaymentPreview*>(preview_model_.get());
  if (!payment_preview_model_)
  {
    LOG_ERROR(logger) << "Could not derive preview model from given parameter.";
    return;
  }

  dash::Preview::InfoHintPtrList hints = preview_model_->GetInfoHints();
  GVariant *preview_data = NULL;
  for (dash::Preview::InfoHintPtr info_hint : hints)
  {
    if (info_hint->id == MusicPaymentPreview::DATA_INFOHINT_ID)
    {
      preview_data = info_hint->value;
      if (preview_data != NULL)
      {
        error_message_ = GetErrorMessage(preview_data);
      }
      break;
    }
  }

  // load the buttons so that they can be accessed in order
  LoadActions();
  PaymentPreview::SetupViews();
}
예제 #2
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;
}
예제 #3
0
파일: main.cpp 프로젝트: slotwin/miranda-ng
static int IconsChanged(WPARAM, LPARAM)
{
	LoadActions();

	CLISTMENUITEM mi = { sizeof(mi) };
	if (PopupOptions.ModuleIsEnabled == TRUE) { //The module is enabled.
		//The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item.
		mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0);
	}
	else { //The module is disabled.
		//The action to do is enable popups (show enabled), then write "disable popup" in the new item.
		mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0);
	}
	mi.flags = CMIM_ICON;
	Menu_ModifyItem(hMenuItem, &mi);
	Menu_ModifyItem(hMenuRoot, &mi);

	mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0);
	mi.flags = CMIM_ICON;
	Menu_ModifyItem(hMenuItemHistory, &mi);
	return 0;
}
예제 #4
0
static int IconsChanged(WPARAM wParam,LPARAM lParam){
	LoadActions();

	CLISTMENUITEM mi = { 0 };
	mi.cbSize = sizeof(mi);

	if (PopUpOptions.ModuleIsEnabled == TRUE) { //The module is enabled.
		//The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item.
		mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON,0);
	}
	else { //The module is disabled.
		//The action to do is enable popups (show enabled), then write "disable popup" in the new item.
		mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0);
	}
	mi.flags = CMIM_ICON;
	CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItem,(LPARAM)&mi);
	CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuRoot,(LPARAM)&mi);

	mi.hIcon = IcoLib_GetIcon(ICO_HISTORY,0);
	mi.flags = CMIM_ICON;
	CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItemHistory,(LPARAM)&mi);

	if (hTTButton >= 0) {
		TTBButtonV2 btn = {0};
		btn.cbSize = sizeof(btn);
		btn.pszServiceUp = btn.pszServiceDown = MENUCOMMAND_SVC;
		btn.lParamUp = 1;
		btn.lParamDown = 0;
		btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
		btn.name = Translate("Toggle Popups");
		btn.tooltipUp = Translate("Popups are disabled");
		btn.tooltipDn = Translate("Popups are enabled");
		btn.hIconUp = IcoLib_GetIcon(ICO_POPUP_OFF,0);
		btn.hIconDn = IcoLib_GetIcon(ICO_POPUP_ON,0);
		hTTButton = CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_ALLDATA, hTTButton), (LPARAM)&btn);
	}

	return 0;
}
예제 #5
0
파일: Game.cpp 프로젝트: cxuhua/cxengine
void Game::OnMain()
{
    SetPlanSize(cxSize2F(2048, 1536));
//
    const cxStr *data = nullptr;
    {
        cxStr *code = cxStr::UTF8("8347834");
        IndexType message = IndexType_init_zero;
        message.tid = 200;
        message.code = CX_STR_PB_ENCODE(code);
        data = cxStr::PBEncode(IndexType_fields, &message);
        cxUtil::Instance()->WriteDocument("test.dat", data, true);
    }
    {
        cxStr *code = cxStr::Create();
        IndexType m2 = IndexType_init_zero;
        m2.code = CX_STR_PB_DECODE(code);
        cxBool ok = data->PBDecode(IndexType_fields, &m2);
        CX_LOGGER("%d",ok);
    }
    
//    LoadTexture("grid.png","grid");
//
//    cxSprite *sp = cxSprite::Create();
//    sp->SetSize(cxSize2F(64));
//    sp->SetTexture("grid");
//    Window()->Append(sp);
//    
//    cxMoveTo::Create(cxPoint2F(0, 512), 6)->AttachTo(sp)->onExit+=cxAction::Remove;
//    
//    {
//        cxSprite *sp2 = cxSprite::Create();
//        sp2->SetSize(cxSize2F(64));
//        sp2->SetTexture("grid");
//        sp2->SetColor(cxColor4F::RED);
//        Window()->Append(sp2);
//        
//        cxFollow::Create(sp, 50)->AttachTo(sp2);
//    }
    
//    Controller *cv = Controller::Create(6, 6);
//    cv->SetResizeFlags(cxView::ResizeBottom);
//    Window()->Append(cv);
//
//    return;
    //加载纹理
    LoadTexture("jl.lqt");
    //加载帧序列
    LoadFrames("frames.csv");
    //加载动作组
    LoadActions("actions.csv");
    //获取法师帧序列
    const cxFrames *fs = GetFrames("Mage");
    //获取法师的动作列表
    const cxActionGroup *ag = GetActions("Mage");
    //获得move动作
    
    //创建动画
    {
        //获得动作组
        const cxActionAttr *move = ag->Action("attack");
        //创建动画
        cxAnimate *animate = fs->Animate();
        animate->onFrame+=[](cxAnimate *pav,cxInt frame){
            CX_LOGGER("%d %d",frame,pav->IsKeyFrame());
        };
        animate->SetAction(move, 1);
        animate->SetSpeed(1.0f);
        //创建载体
        cxAtlas *atlas = cxAtlas::Create();
        atlas->SetFlipX(true);
        atlas->SetSize(cxSize2F(200, 200));
        atlas->Append(animate);//加入动画
        //载体加入绘制
        Window()->Append(atlas);
    }
    
    {
        const cxActionAttr *move = ag->Action("move");
        cxAnimate *animate = fs->Animate();
        animate->onFrame+=[](cxAnimate *pav,cxInt frame){
            CX_LOGGER("%d %d",frame,pav->IsKeyFrame());
        };
        animate->SetAction(move, 1);
        animate->SetSpeed(1.0f);
        //
        cxAtlas *atlas = cxAtlas::Create();
        atlas->SetFlipX(true);
        atlas->SetSize(cxSize2F(200, 200));
        atlas->SetPosition(cxPoint2F(0, 300));
        animate->AttachTo(atlas);
        Window()->Append(atlas);
    }
}
예제 #6
0
//menu
//Function which makes the initializations
static int ModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	//check if 'Icon Library Manager' and 'FontService' exist (load icon and font later)
	if (!ServiceExists(MS_FONT_REGISTER) || !ServiceExists(MS_SKIN2_ADDICON)) {
		LPTSTR msg = TranslateTS(
			_T("This version of Popup Plus requires\r\n")
			_T("'Icon Library Manager' and 'FontService'\r\n")
			_T("modules.\r\n")
			_T("\r\n")
			_T("You always can download them at\r\n")
			_T("http://addons.miranda-im.org/\r\n")
			_T("\r\n")
			_T("Do you want to visit Miranda IM homepage now?\r\n") );
		if (MessageBox(NULL, msg, _T("Popup Plus Error"), MB_YESNO|MB_ICONSTOP) == IDYES)
			ShellExecute(NULL, _T("open"), _T("http://addons.miranda-im.org/"), NULL, NULL, SW_SHOWNORMAL);
		return 0;
	}

	//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();
	}
/*/deprecatet stuff
	notifyLink = ServiceExists(MS_NOTIFY_GETLINK) ? (MNOTIFYLINK *)CallService(MS_NOTIFY_GETLINK, 0, 0) : NULL;
	LoadNotifyImp();
	hNotifyOptionsInitialize = HookEvent(ME_NOTIFY_OPT_INITIALISE, NotifyOptionsInitialize);

	HookEvent(ME_CONTACTSETTINGS_INITIALISE, ContactSettingsInitialise);
*/
	//Uninstalling purposes
	if (ServiceExists("PluginSweeper/Add")) {
		CallService("PluginSweeper/Add",(WPARAM)Translate(MODULNAME),(LPARAM)MODULNAME);
	}
	//load fonts / create hook
	InitFonts();
	hFontsChanged = HookEvent(ME_FONT_RELOAD,FontsChanged);

	//load actions and notifications
	LoadActions();
	LoadNotifications();
	//hook TopToolBar
	hTTBLoaded = HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
	//Folder plugin support
	LPTSTR pszPath = mir_a2t(MIRANDA_PATH "\\Skins\\PopUp");
	folderId = FoldersRegisterCustomPathT(MODULNAME_LONG, "Skins", pszPath);
	mir_free(pszPath);
	//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();
	//Modern Toolbar support
	if(ServiceExists(MS_TB_ADDBUTTON)) {
		hTBLoaded = HookEvent(ME_TB_MODULELOADED, ToolbarSet);
		ToolbarSet(0,0);
	}
	//Updater support
	if(ServiceExists(MS_UPDATE_REGISTER)) registerUpdate();

	gbPopupLoaded = TRUE;
	return 0;
}