Ejemplo n.º 1
0
void RestoreModuleData(HWND hdlg)
{
	int iBl=0,i=0;
	char szMEntry[256]={'\0'};
	while(ButtonsList[iBl])
	{
		SortedList * sl=NULL;
		ListData* ld=ButtonsList[iBl];

		if (!(sl=ld->sl)) break;

		if(ld->dwOPFlags&QMF_NEW)
		{
			DestroyButton(iBl);
			continue;
		}

		if(ld->ptszQValue!=ld->ptszOPQValue)	
		{
			if(ld->ptszOPQValue)
				mir_free(ld->ptszOPQValue);

			ld->ptszOPQValue=(ld->ptszQValue)?ld->ptszQValue:NULL;
		}

		ld->bIsOpServName=ld->bIsServName;
		ld->dwOPFlags=0;

		qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons); 

		for ( i=0; i < sl->realCount; i++ ) {
			ButtonData * bd= (ButtonData *)sl->items[i];

			if(bd->dwOPFlags&QMF_NEW){
				RemoveMenuEntryNode(sl, i--);
				continue;
			}
			bd->bIsOpServName=bd->bIsServName;
			bd->bOpInQMenu=bd->bInQMenu;
			bd->dwOPPos=bd->dwPos;
			bd->fEntryOpType=bd->fEntryType;
			bd->dwOPFlags=0;

			if(bd->pszName!=bd->pszOpName)
			{
				if(bd->pszOpName)
					mir_free(bd->pszOpName);
				bd->pszOpName=bd->pszName?bd->pszName:NULL;
			}

			if(bd->pszValue!=bd->pszOpValue)
			{
				if(bd->pszOpValue)
					mir_free(bd->pszOpValue);
				bd->pszOpValue=bd->pszValue?bd->pszValue:NULL;
			}
		}
		iBl++;
	}
}
Ejemplo n.º 2
0
static void CPROC MoveElementRemove( uintptr_t psv, PSI_CONTROL control )
{
	PMACRO_BUTTON button = (PMACRO_BUTTON)psv;
	PSI_CONTROL list = GetNearControl( control, LIST_MACRO_ELEMENTS );
	PLISTITEM pli = GetSelectedItem( list );
	PMACRO_ELEMENT pme = (PMACRO_ELEMENT)GetItemData( pli );
	if( pme )
	{
		DeleteListItem( list, pli );
		UnlinkThing( pme );
		 DestroyButton( pme->button );
		Release( pme );
		FillList( list, button );
	}
}
Ejemplo n.º 3
0
CTransCtrl::~CTransCtrl( )
{ 
	__Comment( "Desktop Control: Button Destroyed" );
	DestroyButton( );

	if( m_bHooked )
		RemoveHook( ); 

	if( hInst_res_x86 )
		FreeLibrary( hInst_res_x86 );
	
	hInst_res_x86	= NULL;
	
	
	__Comment( "Desktop Control Destructed" );
}
Ejemplo n.º 4
0
void SaveMenuTree(HWND hdlg)
{
	int iBl=0,i=0,k=0;
	int iBtd=g_iButtonsCount;
	BOOL bDeleted=FALSE;
	char szMEntry[256]={'\0'};
	TCHAR strbuf[256];
	HTREEITEM hti=NULL;
	TVITEM tvi;

	g_iButtonsCount=TreeView_GetCount(hButtonsList);

	tvi.pszText = strbuf;
	tvi.cchTextMax = _countof(strbuf);
	tvi.mask=TVIF_HANDLE|TVIF_TEXT ;
	tvi.hItem=TreeView_GetRoot(hButtonsList);

	TreeView_GetItem(hButtonsList,&tvi);

	li_ZeroQuickList(QuickList);

	BalanceButtons(iBtd,g_iButtonsCount);

	while(ButtonsList[iBl])
	{
		SortedList * sl=NULL;
		ListData* ld=ButtonsList[iBl];

		if (!ld->sl) break;

		sl=ld->sl;

		if(ld->dwOPFlags&QMF_DELETNEEDED)
		{
			bDeleted=(ld->dwOPFlags&QMF_NEW)?FALSE:TRUE;
			if(bDeleted) CleanSettings(ld->dwPos,-1);
			DestroyButton(iBl);
			continue;
		}
		if(ld->ptszQValue!=ld->ptszOPQValue)	
		{
			if(ld->ptszQValue)
				mir_free(ld->ptszQValue);

			ld->ptszQValue=(ld->ptszOPQValue)?ld->ptszOPQValue:NULL;
		}

		if(ld->ptszButtonName)
			mir_free(ld->ptszButtonName);
		if(iBl>0)
			if(hti=TreeView_GetNextSibling(hButtonsList,hti?hti:tvi.hItem))
			{
				tvi.hItem=hti;
				TreeView_GetItem(hButtonsList,&tvi);
			}

			ld->ptszButtonName=mir_tstrdup(tvi.pszText);

			if(ld->ptszQValue)
			{
				mir_snprintf(szMEntry, _countof(szMEntry), "ButtonValue_%u", iBl);
				db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszQValue);
			}


			if (ServiceExists(MS_BB_MODIFYBUTTON)&&((ld->dwOPFlags&QMF_NEW)||(ld->dwOPFlags&QMF_RENAMED)||bDeleted))
			{
				BBButton bb={0};
				bb.cbSize=sizeof(BBButton);
				bb.pszModuleName=PLGNAME;
				bb.dwButtonID=iBl;
				bb.ptszTooltip=ld->ptszButtonName;
				CallService(MS_BB_MODIFYBUTTON,0,(LPARAM)&bb);
			}	


			mir_snprintf(szMEntry, _countof(szMEntry), "ButtonName_%u", iBl);
			db_set_ts(NULL, PLGNAME,szMEntry,ld->ptszButtonName);

			ld->dwOPFlags=0;
			ld->dwPos=iBl;
			ld->bIsServName=ld->bIsOpServName;
			mir_snprintf(szMEntry, _countof(szMEntry), "RCEntryIsServiceName_%u", iBl);
			db_set_b(NULL, PLGNAME,szMEntry,ld->bIsServName);

			bDeleted=FALSE;

			qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons); 

			for ( i=0; i < sl->realCount; i++ ) {
				ButtonData * bd= (ButtonData *)sl->items[i];

				if(bd->dwOPFlags&QMF_DELETNEEDED){
					RemoveMenuEntryNode(sl, i--);
					continue;
				}
				bd->bIsServName=bd->bIsOpServName;
				bd->bInQMenu=bd->bOpInQMenu;
				bd->dwPos=bd->dwOPPos;
				bd->fEntryType=bd->fEntryOpType;
				bd->dwOPFlags=0;

				if(bd->pszName!=bd->pszOpName)
				{
					if(bd->pszName)
						mir_free(bd->pszName);
					bd->pszName=bd->pszOpName?bd->pszOpName:NULL;
				}

				if(bd->pszValue!=bd->pszOpValue)
				{
					if(bd->pszValue)
						mir_free(bd->pszValue);
					bd->pszValue=bd->pszOpValue?bd->pszOpValue:NULL;
				}
				if(bd->bInQMenu)
				{
					QuickData* qd = (QuickData *)mir_alloc(sizeof(QuickData));
					qd->dwPos=k++;
					qd->fEntryType=bd->fEntryType;
					qd->bIsService=bd->bIsServName;
					qd->ptszValue=bd->pszValue;
					qd->ptszValueName=bd->pszName;
					List_InsertPtr(QuickList,qd);
				}

				SaveModuleSettings(iBl,bd);
			}
			CleanSettings(iBl,sl->realCount);

			iBl++;
	}

	db_set_b(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
}