Most of the built-in screens in a station have text lined up in columns. It's not possible to do that in an OXP (unless I'm missing something). Some of them get there nearly by padding with spaces, but that's extra complicated, and doesn't line up neatly.
It wouldn't be very hard to support columns in a mission screen. As a proof of concept, I've tried the following:
Code: Select all
--- src/Core/Entities/PlayerEntityLegacyScriptEngine.m (revision 5630)
+++ src/Core/Entities/PlayerEntityLegacyScriptEngine.m (working copy)
@@ -2415,6 +2415,18 @@
// must set special second as setting the descriptor resets it
BOOL overridden = ([self missionBackgroundDescriptor] != nil);
[gui setBackgroundTextureSpecial:[self missionBackgroundSpecial] withBackground:!overridden];
+ OOGUITabSettings tab_stops;
+ tab_stops = 0;
+ tab_stops = 64;
+ tab_stops = 128;
+ tab_stops = 192;
+ tab_stops = 256;
+ tab_stops = 320;
+ tab_stops = 384;
+ tab_stops = 448;
+ [gui setTabStops:tab_stops];
--- src/Core/GuiDisplayGen.m (revision 5630)
+++ src/Core/GuiDisplayGen.m (working copy)
@@ -592,10 +592,18 @@
- (void) setText:(NSString *)str forRow:(OOGUIRow)row align:(OOGUIAlignment)alignment
if (str != nil && RowInRange(row, rowRange))
- [rowText replaceObjectAtIndex:row withObject:str];
- rowAlignment[row] = alignment;
+ if ([str rangeOfString:@"\t"].location != NSNotFound)
+ NSArray *fields = [str componentsSeparatedByString:@"\t"];
+ [rowText replaceObjectAtIndex:row withObject:fields];
+ [rowText replaceObjectAtIndex:row withObject:str];
+ rowAlignment[row] = alignment;
That's not quite good enough, but it shows that it's not too hard. Other things that would need fixing:
- Script to be able to set tab stops, rather than hard-coding them
Script to be able to set alignment per column or per field. That's the tricky bit, I think
The mission summary text on the manifest screen is messed up by this change: it expects different tab stops.
If we had those done, it would be a great advantage.
For the alignment, I'm thinking of having an "expanding space" character. Putting one before text would push it to the right of the column it's in, putting it after would push it left. Both would centre it. I can see how the rendering logic would work.
As it stands, if text overflows a column, it gets overwritten. I think that's probably OK; if you need to clip the text to a column width that's up to the script.