Skip to content

Commit 061931c

Browse files
committed
Added script function SetMainTitle
1 parent 581863c commit 061931c

File tree

10 files changed

+41
-12
lines changed

10 files changed

+41
-12
lines changed

doc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ BEGIN_DISPATCH_MAP(CMUSHclientDoc, CDocument)
612612
DISP_FUNCTION(CMUSHclientDoc, "UnloadPlugin", UnloadPlugin, VT_I4, VTS_BSTR)
613613
DISP_FUNCTION(CMUSHclientDoc, "Bookmark", Bookmark, VT_EMPTY, VTS_I4 VTS_BOOL)
614614
DISP_FUNCTION(CMUSHclientDoc, "SetTitle", SetTitle, VT_EMPTY, VTS_BSTR)
615+
DISP_FUNCTION(CMUSHclientDoc, "SetMainTitle", SetMainTitle, VT_EMPTY, VTS_BSTR)
615616
DISP_PROPERTY_PARAM(CMUSHclientDoc, "NormalColour", GetNormalColour, SetNormalColour, VT_I4, VTS_I2)
616617
DISP_PROPERTY_PARAM(CMUSHclientDoc, "BoldColour", GetBoldColour, SetBoldColour, VT_I4, VTS_I2)
617618
DISP_PROPERTY_PARAM(CMUSHclientDoc, "CustomColourText", GetCustomColourText, SetCustomColourText, VT_I4, VTS_I2)
@@ -7840,5 +7841,3 @@ void CMUSHclientDoc::FixInputWrap()
78407841
} // end of for each view
78417842
} // end of CMUSHclientDoc::FixInputWrap()
78427843

7843-
7844-

doc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ class CMUSHclientDoc : public CDocument
13381338
CString m_strWordUnderMenu; // word under menu in output window
13391339

13401340
CString m_strWindowTitle; // for SetTitle
1341+
CString m_strMainWindowTitle; // for SetMainTitle
13411342

13421343
#ifdef PANE
13431344
// for pane windows
@@ -2764,6 +2765,7 @@ class CMUSHclientDoc : public CDocument
27642765
afx_msg long UnloadPlugin(LPCTSTR PluginID);
27652766
afx_msg void Bookmark(long LineNumber, BOOL Set);
27662767
afx_msg void SetTitle(LPCTSTR Title);
2768+
afx_msg void SetMainTitle(LPCTSTR Title);
27672769
afx_msg long GetNormalColour(short WhichColour);
27682770
afx_msg void SetNormalColour(short WhichColour, long nNewValue);
27692771
afx_msg long GetBoldColour(short WhichColour);

install/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MUSHclient version 4.88
22
=======================
33

4-
Wednesday, 6th February 2013
4+
Monday, 11th February 2013
55

66
Author: Nick Gammon
77
Web support: http://www.gammon.com.au/forum/

mainfrm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,8 @@ void CMainFrame::FixUpTitleBar (void)
865865

866866
CString strTitle;
867867
CString strName;
868+
CString strMainTitle;
869+
868870
int nDocCount = 0;
869871

870872
POSITION pos = App.m_pWorldDocTemplate->GetFirstDocPosition();
@@ -873,6 +875,7 @@ void CMainFrame::FixUpTitleBar (void)
873875
{
874876
CMUSHclientDoc* pDoc = (CMUSHclientDoc*) App.m_pWorldDocTemplate->GetNextDoc(pos);
875877

878+
// find the active world
876879
if (pDoc->m_pActiveCommandView != NULL || pDoc->m_pActiveOutputView != NULL)
877880
{
878881
WINDOWPLACEMENT wp;
@@ -883,6 +886,7 @@ void CMainFrame::FixUpTitleBar (void)
883886
pDoc->m_pActiveOutputView->GetOwner ()->GetOwner ()->GetWindowPlacement (&wp);
884887

885888
strName = pDoc->m_mush_name; // remember world name
889+
strMainTitle = pDoc->m_strMainWindowTitle;
886890

887891
// don't show name again if maximized
888892
if (wp.showCmd == SW_MAXIMIZE)
@@ -918,6 +922,10 @@ void CMainFrame::FixUpTitleBar (void)
918922

919923
GetWindowText (strOldTitle);
920924

925+
// use the title from SetMainTitle if the active world had one
926+
if (!strMainTitle.IsEmpty ())
927+
strTitle = strMainTitle;
928+
921929
// only change title if necessary, to avoid flicker
922930
if (strTitle != strOldTitle)
923931
SetWindowText (strTitle);

mushclient.cnt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@
488488
3 SetEntity=FNC_SetEntity
489489
3 SetForegroundImage=FNC_SetForegroundImage
490490
3 SetInputFont=FNC_SetInputFont
491+
3 SetMainTitle=FNC_SetMainTitle
491492
3 SetNotes=FNC_SetNotes
492493
3 SetOption=FNC_SetOption
493494
3 SetOutputFont=FNC_SetOutputFont

mushclient.odl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ library MUSHclient
7070
[id(44)] long SetCommand(BSTR Message);
7171
[id(45)] BSTR GetNotes();
7272
[id(46)] void SetNotes(BSTR Message);
73-
[id(410), propget] long NormalColour(short WhichColour);
74-
[id(410), propput] void NormalColour(short WhichColour, long nNewValue);
75-
[id(411), propget] long BoldColour(short WhichColour);
76-
[id(411), propput] void BoldColour(short WhichColour, long nNewValue);
77-
[id(412), propget] long CustomColourText(short WhichColour);
78-
[id(412), propput] void CustomColourText(short WhichColour, long nNewValue);
79-
[id(413), propget] long CustomColourBackground(short WhichColour);
80-
[id(413), propput] void CustomColourBackground(short WhichColour, long nNewValue);
73+
[id(411), propget] long NormalColour(short WhichColour);
74+
[id(411), propput] void NormalColour(short WhichColour, long nNewValue);
75+
[id(412), propget] long BoldColour(short WhichColour);
76+
[id(412), propput] void BoldColour(short WhichColour, long nNewValue);
77+
[id(413), propget] long CustomColourText(short WhichColour);
78+
[id(413), propput] void CustomColourText(short WhichColour, long nNewValue);
79+
[id(414), propget] long CustomColourBackground(short WhichColour);
80+
[id(414), propput] void CustomColourBackground(short WhichColour, long nNewValue);
8181
[id(47)] void Redraw();
8282
[id(48)] long ResetTimer(BSTR TimerName);
8383
[id(49)] void SetOutputFont(BSTR FontName, short PointSize);
@@ -441,6 +441,7 @@ library MUSHclient
441441
[id(407)] long UnloadPlugin(BSTR PluginID);
442442
[id(408)] void Bookmark(long LineNumber, BOOL Set);
443443
[id(409)] void SetTitle(BSTR Title);
444+
[id(410)] void SetMainTitle(BSTR Title);
444445
//}}AFX_ODL_METHOD
445446

446447
};

resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@
15621562
#ifdef APSTUDIO_INVOKED
15631563
#ifndef APSTUDIO_READONLY_SYMBOLS
15641564
#define _APS_3D_CONTROLS 1
1565-
#define _APS_NEXT_RESOURCE_VALUE 367
1565+
#define _APS_NEXT_RESOURCE_VALUE 368
15661566
#define _APS_NEXT_COMMAND_VALUE 33054
15671567
#define _APS_NEXT_CONTROL_VALUE 2897
15681568
#define _APS_NEXT_SYMED_VALUE 312

scripting/functionlist.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ tInternalFunctionsTable InternalFunctionsTable [] = {
346346
{ "SetEntity" , "( Name , Contents )" } ,
347347
{ "SetForegroundImage" , "( FileName , Mode )" } ,
348348
{ "SetInputFont" , "( FontName , PointSize , Weight , Italic )" } ,
349+
{ "SetMainTitle" , "( Title )" } ,
349350
{ "SetNotes" , "( Message )" } ,
350351
{ "SetOption" , "( OptionName , Value )" } ,
351352
{ "SetOutputFont" , "( FontName , PointSize )" } ,

scripting/lua_methods.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,6 +5338,15 @@ static int L_SetInputFont (lua_State *L)
53385338
return 0; // number of result fields
53395339
} // end of L_SetInputFont
53405340

5341+
//----------------------------------------
5342+
// world.SetMainTitle
5343+
//----------------------------------------
5344+
static int L_SetMainTitle (lua_State *L)
5345+
{
5346+
CMUSHclientDoc * pDoc = doc (L); // must do this first
5347+
pDoc->SetMainTitle (concatArgs (L).c_str ());
5348+
return 0; // number of result fields
5349+
} // end of L_SetMainTitle
53415350

53425351
//----------------------------------------
53435352
// world.SetNotes
@@ -6979,6 +6988,7 @@ static const struct luaL_Reg worldlib [] =
69796988
{"SetEntity", L_SetEntity},
69806989
{"SetForegroundImage", L_SetForegroundImage},
69816990
{"SetInputFont", L_SetInputFont},
6991+
{"SetMainTitle", L_SetMainTitle},
69826992
{"SetNotes", L_SetNotes},
69836993
{"SetOption", L_SetOption},
69846994
{"SetOutputFont", L_SetOutputFont},

scripting/methods/methods_output.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,3 +835,10 @@ void CMUSHclientDoc::SetTitle(LPCTSTR Title)
835835
} // end of loop through views
836836

837837
}
838+
839+
840+
void CMUSHclientDoc::SetMainTitle(LPCTSTR Title)
841+
{
842+
m_strMainWindowTitle = Title;
843+
Frame.FixUpTitleBar ();
844+
}

0 commit comments

Comments
 (0)