Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

52
LINES

< > BotCompany Repo | #1030781 // Set Font Size For All Modules

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1059K of libraries. Click here for Pure Java version (6455L/30K).

1  
!7
2  
3  
cmodule2 FixFonts > DynEnabled {
4  
  switchable int fontSize = 16;
5  
  
6  
  transient RSTOverQ rstUpdateAllModules = dm_rstOverModuleQ(this, r updateAllModules_impl);
7  
  
8  
  start {
9  
    dm_onAnyModuleVisualized(mod -> {
10  
      //print("Module " + mod + " visualized: " + dm_vis(mod));
11  
      dm_q(r { updateModule(mod) });
12  
    });
13  
    dm_onFieldChangeAndNow(ll("fontSize", "enabled"), r updateAllModules);
14  
    
15  
    dm_vmBus_onMessage updateLayoutNow(voidfunc(JComponent c) {
16  
      updateComponent(c);
17  
    });
18  
    
19  
    dm_vmBus_answerToMessage formSafetyMargin(() -> 20);
20  
  }
21  
  
22  
  visualize {
23  
    JComponent c = super.visualize();
24  
    addToControlArea(dm_intSpinnerWithLabel fontSize(1, 100));
25  
    ret jfullcenter(c);
26  
  }
27  
  
28  
  void updateAllModules { rstUpdateAllModules.trigger(); }
29  
  
30  
  void updateAllModules_impl {
31  
    if (!enabled) ret;
32  
    L mods = lambdaFilter dm_isShowing(dm_moduleIDs());
33  
    if (empty(mods)) ret;
34  
    time {
35  
      print("Setting font size of " + nModules(mods) + " to " + fontSize + "...");
36  
      for (O mod : mods)
37  
        updateModule(mod);
38  
    }
39  
  }
40  
  
41  
  void updateModule(O mod) {
42  
    if (!enabled) ret;
43  
    updateComponent(dm_vis(mod));
44  
  }
45  
  
46  
  void updateComponent(JComponent c) {
47  
    if (c != null) swing {
48  
      setAllStandardFontSizesRecursively(c, fontSize, c2 ->
49  
        !eq(shortClassName(c2), "RSyntaxTextArea"));
50  
    }
51  
  }
52  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030781
Snippet name: Set Font Size For All Modules
Eternal ID of this version: #1030781/29
Text MD5: d7a80caf6e55aa6c2aeabf2f1438f194
Transpilation MD5: 59c4b320fd6a9f6f1acf5d61e7cecb65
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-05 23:14:50
Source code size: 1409 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 211 / 4152
Version history: 28 change(s)
Referenced in: [show references]