Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: state refactor #571

Closed
wants to merge 42 commits into from
Closed

refactor: state refactor #571

wants to merge 42 commits into from

Commits on Aug 23, 2021

  1. Configuration menu
    Copy the full SHA
    f73ea0d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5749c32 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fceae8d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4f0eb7b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e657fec View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    64c6d0c View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2021

  1. refactor: add glue to prep for the transition

    Write some glue code to transition from the old code to the new one.
    ClementTsang committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    88ebcab View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2021

  1. refactor: more glue code to build layout

    Even more glue code to help glue together our layout options to our new
    layout system!
    
    Note that this PR will most likely likely break the two options:
    - default_widget_type
    - default_widget_count
    and as such, they'll probably be deleted in a later commit.
    
    As for why, it's since they're kinda a pain to support and don't work
    well. Users can still enable default widget selection through the
    layout system (which will also see a revamp in the future).
    ClementTsang committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    b5e6dea View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    189be96 View commit details
    Browse the repository at this point in the history
  3. refactor: rip out trait system for drawing widgets

    This rips out this weird trait system I previously used for drawing
    widgets, where I implemented a trait onto the Painter struct that did
    the drawing.  I have no idea what I was thinking back then.
    ClementTsang committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    dd7e183 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2021

  1. refactor: start moving over drawing system

    In particular, moving over table-style widgets
    ClementTsang committed Aug 28, 2021
    Configuration menu
    Copy the full SHA
    0afc371 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6b69e37 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b72e76a View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2021

  1. refactor: port over graph widgets

    Things working as of now:
    - Actually drawing
    - Interpolation
    - Styling
    ClementTsang committed Aug 29, 2021
    Configuration menu
    Copy the full SHA
    2bff04d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    64d47d5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    74293aa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ec203c View commit details
    Browse the repository at this point in the history
  5. refactor: change up event handling logistics

    Slightly move around the ideas of EventResult, ReturnSignalResult,
    and how they all work.
    
    The gist of it is that we now have widgets returning EventResults (and
    renamed to WidgetEventResult), and the main app event handler returns
    ReturnSignalResult (now named EventResult).
    
    Also add a new signal to handle re-updating data inputs! This is needed
    for the process, and any sortable/configurable widget.
    ClementTsang committed Aug 29, 2021
    Configuration menu
    Copy the full SHA
    48c572d View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2021

  1. bug: fix bug causing click bounds to fail

    There were three bugs:
    
    1. The click bounds calculation was incorrect. I did the silly mistake
       of checking for <= bounds for the bottom and right sections of a
       Rect when checking if the mouse intersected - this is WRONG.
    
       For example, let's say you want to calculate if an x value of 5 falls
       between something that starts at 0 and is 5 long.  It shouldn't,
       right?  Because it draws from 0 to 4?  But if you just did <=
       Rect.right(), you would get a hit - because it just does (start +
       width), so you get 5, and 5 <= 5!
    
       So, easy fix, change all far bounds checks to <.
    
    2. The second bug is a mistake where I accidentally did not include
       bounds sets for my memory and net widgets. Instead, they set their
       bounds to the underlying graph representation, which is WRONG, since
       that bound gets updated on draw, and gets set to a slightly smaller
       rect due to borders!
    
    3. A slightly sneakier one. This broke my bounds checks for the CPU
       widget - and it would have broken my process widget too.
    
       The problem lies in the concept of widgets that handle multiple
       "sub"-blocks internally, and how I was doing click detection
       internally - I would check if the bounds of the internal Components
       were hit.  Say, the CPU, I would check if the internal graph was hit,
       then if the internal table was hit.
    
       But wait! I said in point 2 that a graph gets its borders updated on
       draw to something slightly smaller, due to borders!  And there's the
       problem - it affected tables too.  I was setting the bounds of
       components to that of the *internal* representation - without borders
       - but my click detection *needed* borders included!
    
       Solution?  Add another trait function to check bordered bounds, and
       make the default implementation just check the existing bounds. For
       cases like internal Components that may need it, I add a separate
       implementation.
    
       I also switched over all border bounds checks for Widgets to that,
       since it's a bit more consistent.
    ClementTsang committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    3fa5060 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2021

  1. Configuration menu
    Copy the full SHA
    27736b7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b1889b0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    204b4dc View commit details
    Browse the repository at this point in the history
  4. refactor: move basic mode over

    Because writing your own layout system and management is just *so much
    fun*. Totally.
    
    -------------------------------------------------------------------
    
    Moves the basic mode system over to the new drawing/widget system. In
    the process, it has forced me to completely redo how we do layouts...
    again. This is because basic mode has widgets that control their own
    height - this means the height of the columns and rows that wrap it
    are also affected by the widget's height.
    
    The previous system, using a constraint tree and splitting draw Rects
    via tui-rs' built-in constraint solver, did not support this concept
    very well. It was not simple to propagate up the widths/heights
    towards parents while also using tui-rs' built-in constraint solver.
    In the end, it was easier to just rewrite it using another algorithm.
    
    We now follow a process very similar to Flutter's layout system.
    Relevant links to the Flutter docs are found in the code or below:
    
    - https://flutter.dev/docs/development/ui/layout/constraints
    - https://flutter.dev/docs/resources/inside-flutter#sublinear-layouts
    
    The gist of it, however, is that we now instead a few new options for
    any element in the layout tree. A node can either:
    
    - Grow to fill remaining space
    - Take up as much room as its children
    - Be a specific length
    
    Technically right now, it's not perfect, in that leaf nodes can be as
    large as their children (which makes no sense), though in that case it
    just treats it as an expand.
    ClementTsang committed Sep 5, 2021
    Configuration menu
    Copy the full SHA
    eddc9a1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    fa00dec View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    18af6b0 View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. refactor: add back widget titles

    Also has a few clippy fixes and bug fixes:
    - Fix redundant rerendering on scroll on time graphs.
    - Fix being off by one cell during rendering for no-battery situation
      on the battery widget.
    - Fix having empty columns for
      rtl column width calculations (as otherwise it goes to the wrong column).
    - Fix rendering issue on small windows with text tables.
    
    We also now ensure that the CPU legend has enough room to draw!
    ClementTsang committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    9ef38cb View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2021

  1. Configuration menu
    Copy the full SHA
    d8a6a23 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    955840b View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2021

  1. Configuration menu
    Copy the full SHA
    587987a View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2021

  1. refactor: add general keybinds, fix buggy movement

    Adds back some of the general program keybinds, and fixes both a bug causing
    widget movement via keybinds to be incorrect, and not correcting the
    last selected widget in the layout tree rows/cols after clicking/setting
    the default widget!
    ClementTsang committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    e7b9c72 View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2021

  1. Configuration menu
    Copy the full SHA
    7ee85a8 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2021

  1. Configuration menu
    Copy the full SHA
    abcca77 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2021

  1. Configuration menu
    Copy the full SHA
    35ec66e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5c87974 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b6ca3e0 View commit details
    Browse the repository at this point in the history
  4. refactor: delete more stuff

    Mostly previously re-added files during the merge conflict resolution,
    and a lot of unused code.
    
    Still more to delete after I finish rewriting the process kill dialog.
    ClementTsang committed Sep 26, 2021
    Configuration menu
    Copy the full SHA
    9089231 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2021

  1. Configuration menu
    Copy the full SHA
    f02daa0 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2021

  1. Configuration menu
    Copy the full SHA
    5833cb8 View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2021

  1. refactor: mostly add back tree mode for process

    Mouse control on collapse is not working yet, need to do some work
    internally first.
    ClementTsang committed Nov 21, 2021
    Configuration menu
    Copy the full SHA
    cc66f1f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    16babea View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2021

  1. Configuration menu
    Copy the full SHA
    e89d46e View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2021

  1. Configuration menu
    Copy the full SHA
    1593847 View commit details
    Browse the repository at this point in the history