diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-05 16:54:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-05 16:54:27 +0000 |
commit | b665a90f50f09435aef5bc3b5b9da710e4558690 (patch) | |
tree | 3053606dcddc1b15f73e7af1fb2507afbf20f052 /protocols/IRCG/src | |
parent | 6c01981a8452577f3751298c7cdbe59b3ae81d51 (diff) |
various menu items quirks, simplifications & optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@4319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IRCG/src')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 12 | ||||
-rw-r--r-- | protocols/IRCG/src/input.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/options.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 70 | ||||
-rw-r--r-- | protocols/IRCG/src/windows.cpp | 2 |
7 files changed, 42 insertions, 54 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 3108066951..bd6021e292 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2332,9 +2332,9 @@ void CIrcProto::OnIrcDisconnected() CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | CMIF_GRAYED;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuJoin, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuList, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuNick, (LPARAM)&mi);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -2362,9 +2362,9 @@ bool CIrcProto::DoOnConnect( const CIrcMessage* ) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuJoin, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuList, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuNick, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuJoin, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuList, (LPARAM)&mi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuNick, (LPARAM)&mi);
int Temp = m_iStatus;
m_iStatus = ID_STATUS_ONLINE;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index c564b7844c..eafeae75fb 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -587,7 +587,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac DoUserhostWithReason(2, S.c_str(), true, one.c_str());
} }
- CallService( MS_MSG_SENDMESSAGE, ( WPARAM )hContact2, 0 );
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact2, 0);
}
if ( !two.IsEmpty()) {
@@ -661,7 +661,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac } }
if ( three.IsEmpty())
- CallService( MS_FILE_SENDFILE, ( WPARAM )hContact, 0 );
+ CallService(MS_FILE_SENDFILE, (WPARAM)hContact, 0);
else {
CMString temp = GetWordAddress(text.c_str(), 3);
TCHAR* pp[2];
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 1f13b5159f..e6fd017765 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -206,7 +206,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) FindLocalIP(con); // get the local ip used for filetransfers etc
if ( info.m_iSSL > 0 ) {
- if ( !CallService( MS_NETLIB_STARTSSL, ( WPARAM ) con, 0 ) && info.m_iSSL == 2 ) {
+ if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)con, 0) && info.m_iSSL == 2) {
Netlib_CloseHandle( con );
con = NULL;
m_info.Reset();
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 42aeddb16e..95df8741a2 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -160,7 +160,7 @@ CIrcProto::~CIrcProto() DeleteCriticalSection( &m_gchook );
if (hMenuRoot)
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
mir_free( m_alias );
@@ -1035,7 +1035,7 @@ int __cdecl CIrcProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.ptszName = m_tszUserName;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&mi );
+ CallService( MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, ( LPARAM )&mi );
}
break;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 36f211655f..d05b07df1a 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -765,7 +765,7 @@ void CConnectPrefsDlg::OnApply() mi.flags = CMIM_FLAGS;
if ( !m_proto->m_useServer )
mi.flags |= CMIF_GRAYED;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_proto->hMenuServer, ( LPARAM )&mi );
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_proto->hMenuServer, (LPARAM)&mi);
m_proto->m_joinOnInvite = m_autoJoin.GetState();
m_proto->m_hideServerWindow = !m_showServer.GetState();
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index b65c92f728..c8204ac5d6 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -44,7 +44,7 @@ void CIrcProto::InitMainMenus(void) }
else {
if (hMenuRoot)
- CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 );
+ CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
hMenuRoot = NULL;
}
@@ -129,15 +129,12 @@ static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam) int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuChanSettings, false);
+ Menu_ShowItem(hUMenuWhois, false);
+ Menu_ShowItem(hUMenuDisconnect, false);
+ Menu_ShowItem(hUMenuIgnore, false);
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuPreBuild(wParam, lParam) : 0;
}
@@ -1006,53 +1003,44 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM)
{
DBVARIANT dbv;
- HANDLE hContact = ( HANDLE )wParam;
- if ( !hContact )
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact == NULL)
return 0;
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
-
char *szProto = GetContactProto(hContact);
- if ( szProto && !lstrcmpiA(szProto, m_szModuleName)) {
- bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE ? false : true;
- if ( getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM) {
- // context menu for chatrooms
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
- }
- else if ( !getTString( hContact, "Default", &dbv )) {
- // context menu for contact
- BYTE bDcc = getByte( hContact, "DCC", 0) ;
+ if (szProto && !lstrcmpiA(szProto, m_szModuleName)) {
+ bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE;
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&mi );
+ // context menu for chatrooms
+ if (getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM)
+ Menu_ShowItem(hUMenuChanSettings, true);
- mi.flags = CMIM_FLAGS;
- if ( bDcc ) {
- // for DCC contact
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuDisconnect, ( LPARAM )&mi );
- }
+ // context menu for contact
+ else if ( !getTString( hContact, "Default", &dbv )) {
+ Menu_ShowItem(hUMenuChanSettings, false);
+
+ // for DCC contact
+ BYTE bDcc = getByte( hContact, "DCC", 0) ;
+ if (bDcc)
+ Menu_ShowItem(hUMenuDisconnect, true);
else {
// for normal contact
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if ( !IsConnected())
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuWhois, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuWhois, IsConnected());
+ bool bEnabled = true;
if (bIsOnline) {
DBVARIANT dbv3;
if ( !getString( hContact, "Host", &dbv3)) {
if (dbv3.pszVal[0] == 0)
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- DBFreeVariant( &dbv3 );
+ bEnabled = false;
+ DBFreeVariant(&dbv3);
}
}
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuIgnore, ( LPARAM )&mi );
+ Menu_ShowItem(hUMenuIgnore, bEnabled);
}
DBFreeVariant( &dbv );
- } }
+ }
+ }
return 0;
}
@@ -1245,5 +1233,5 @@ void CIrcProto::DoNetlibLog( const char* fmt, ... ) mir_vsnprintf( str, 32000, fmt, vararg );
va_end( vararg );
- CallService( MS_NETLIB_LOG, ( WPARAM )hNetlib, ( LPARAM )str );
+ CallService( MS_NETLIB_LOG, (WPARAM)hNetlib, ( LPARAM )str );
}
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index ad8a16fec7..c20ceebc1c 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -87,7 +87,7 @@ void CWhoisDlg::OnInitDialog() GetObject( hFont, sizeof( lf ), &lf );
lf.lfWeight = FW_BOLD;
hFont = CreateFontIndirect( &lf );
- m_AwayTime.SendMsg( WM_SETFONT, ( WPARAM )hFont, 0 );
+ m_AwayTime.SendMsg(WM_SETFONT, (WPARAM)hFont, 0);
CCoolIrcDlg::OnInitDialog();
|