Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Jul 16, 2008 9:16 am   

Request for changes in xml export
 
Request: write all setting values when exporting them to a xml file. I write this with button properties "width" and "height" in mind, as well as with upcoming 3.x betas, but there may be more similar issues.

Explanation: when I installed 2.30 I've recreate my session from sratch (I was forced to export everything to xml file in 2.29 as my tests with %btncol function ultimately cause toggle button cease redraw itself properly). Currently, when you export a button, its dimensions is only saved if they are not equal to default values (set in window properties). But this means that you MUST remember later what your settings were set to and tweak them again before importing anything! Naturally, I've forgotten about them.

Sitting with freshly imported settings and looking at odd-shaped buttons, I tried to understand why this particular optimization was ever been introduced. Save several bytes on a drive with gigabytes of free space? Yeah, maybe the idea was cool (save only non-standard dimensions, take the rest from the session properties), but I think it is not the right place for it. While I can see reasons for using optimizations somewhere else, I can see no reasons to optimize the .xml file.

Xml is a kind of a last resort, when other ways can't help you recover your package. Splitting package data between several files definitely will not help with recovering, which is not fun on its own. So I want to ask you to write all setting values while exporting them to xml format. Better save more and them strip unnecessary data on reading rather then lost anything on writing. I suggest to use session setting for button size only for newly created buttons and not for buttons that are already defined in a xml file.

If you will decide to go on with my suggestion, I think it will not take too much time to implement it because you will need to remove the only IF case in XML-writer routine that checks if current setting value is equals to default value.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Jul 16, 2008 4:44 pm   
 
Saving all of your Preferences (like default button sizes) to XML is planned for the future. Currently the XML only saves the properties stored for the settings themselves, and the default button sizes are not saved with the individual buttons but are saved in a different Preferences database table that is not exported yet.

So, this isn't a case of "optimization". It's just a case where the Preferences are not being exported yet at all. Adding this requires a fair amount of work, in addition to adding an XML tab page to the Preferences dialog. It is planned for the future, but not until after the mapper work.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Jul 16, 2008 5:32 pm   
 
I did not ask for saving all of my preferences, not even part of them. I'm really sorry that my post confused you. I asked you to save button width and height for each button defined in the current session. CMUD already do that, but only partially.

Currently it looks like:
Code:
<button name="btnSpellWealth" autosize="false" height="20" autopos="false" top="420" toolbar="2" toolstyle="true" transparent="false" color="#FF8080" priority="5320" id="119">
  <caption>Wealth and Glory...</caption>
  <value>...</value>
</button>


As you can see, the button has height="20" property in XML, but has not any width property in it. Current settings in preferences for that window: default button width = 100, default button height = 23. That's why xml does not have width property - it is equal to default width setting.

Now, if I gonna create a clean session, I may forget about my 100/25 settings. Then, if I'll import my package from a xml file, CMUD will find that button should have height=20, but there is no width property exist and will look in the preferences. If I remember it right, default width for a new session is set to 80. So, I'll end up with 80x20 button instead of 100x20!

That what I asked you for: force writing of width and height properties to the xml no matter what.
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Wed Jul 16, 2008 7:06 pm   
 
But that defeats the whole idea of a "default". Currently, if you wanted to change the width of them all, then you would only have to change the default. But with this change, you would have to change them all individually. And doing it only at save time means the behavior changes: before you export, it would resize with the default, but after a save/reload, it doesn't any more.

I don't use buttons, but can't you force a width on the button at creation (or after)? That way, it should have a custom size that persists, I would think. Then it would be up to the designer to decide whether the button size is fixed, or inherits the default.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Jul 16, 2008 8:19 pm   
 
Zhiroc:
Well, in my previous post I gave an example of a button with user-defined dimensions. Currently if you have autosize==true, then CMUD will use default values and will not put them in xml. That's ok. But if you have autosize==false, then things a bit different. If you look at the button sample code I posted above, you will notice that it has autosize==false, i.e. I've told CMUD dont get in my way with defaults, but it did. Anyway, I appreciate your answer. Actually, I can easily combine your "idea of defaults" and my "save all user input" approach. The logic is straightforward and clear:

On xml writing:
If a button has autosize==true, then use default sizes and do not write any dimension attributes in the xml;
otherwise put both dimensions to the xml

On xml reading (already implemented in CMUD):
If a button has autosize==true, then use default sizes;
otherwise initialize size with defaults and try to read dimension attributes from xml
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Jul 16, 2008 9:11 pm   
 
OK, I understand what Arde is saying, and yes, I think it is a bug. If autosize=false, then the XML *should* output both values even if they are equal to the default. Sorry I misunderstood your post.

Edited: This was a trivial fix and is included in v2.32.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Jul 16, 2008 9:57 pm   
 
Thanks a lot! Very Happy
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net